AT_abc465_e.Digit Circus
提高+/省选-
通过率:0%
时间限制:2.00s
内存限制:1024MB
AC君温馨提醒
该题目为【atcoder】题库的题目,您提交的代码将被提交至atcoder进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Find, modulo 998244353, the number of integers x with 1≤x≤N that satisfy exactly one of the following three conditions.
- x is a multiple of 3.
- The decimal representation of x contains
3. - Exactly three different digits are used in the decimal representation of x.
Here, the decimal representation of an integer should not have unnecessary leading 0s.
在模 998244353 意义下,求满足以下恰好一个条件的整数 x 的个数,其中 1≤x≤N:
- x 是 3 的倍数;
- x 的十进制表示中包含数字
3; - x 的十进制表示中恰好使用了三个不同的数字。
注意:整数的十进制表示不应包含多余的前导 0。
输入格式
The input is given from Standard Input in the following format:
N
输入从标准输入中按以下格式给出:
N
输出格式
Output the answer.
输出答案。
输入输出样例
输入#1
45
输出#1
19
输入#2
1013
输出#2
424
输入#3
2
输出#3
0
输入#4
314159265358979323846264338327950
输出#4
658111391
说明/提示
Sample 1 Explanation:
Among the integers from 1 to 45, there are 19 integers satisfying exactly one of the conditions in the problem statement, as follows.
- There are 10 integers satisfying only the first condition: 6,9,12,15,18,21,24,27,42,45.
- There are 9 integers satisfying only the second condition: 13,23,31,32,34,35,37,38,43.
- There are no integers satisfying only the third condition.
Sample 2 Explanation:
Below are examples of applicable integers.
- Integers satisfying only the first condition include 555 and 1011.
- Integers satisfying only the second condition include 343 and 553.
- Integers satisfying only the third condition include 1012 and 704.
Sample 3 Explanation:
There are no applicable integers.
Constraints
- N is an integer.
- 1≤N<10500
样例 1 解释:
在 1 到 45 的整数中,恰好满足题目所述三个条件中唯一一个条件的整数共有 19 个,具体如下:
- 仅满足第一个条件的整数有 10 个:6,9,12,15,18,21,24,27,42,45。
- 仅满足第二个条件的整数有 9 个:13,23,31,32,34,35,37,38,43。
- 没有任何整数仅满足第三个条件。
样例 2 解释:
以下是符合条件的整数示例:
- 仅满足第一个条件的整数包括 555 和 1011。
- 仅满足第二个条件的整数包括 343 和 553。
- 仅满足第三个条件的整数包括 1012 和 704。
样例 3 解释:
不存在符合条件的整数。
约束条件
- N 是一个整数。
- 1≤N<10500
输入解题思路,AI测评打分。不知道怎么写?