AT_abc465_e.Digit Circus

提高+/省选-

通过率:0%

时间限制:2.00s

内存限制:1024MB

AC君温馨提醒

该题目为【atcoder】题库的题目,您提交的代码将被提交至atcoder进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Find, modulo 998244353998244353, the number of integers xx with 1≤x≤N1 \leq x \leq N that satisfy exactly one of the following three conditions.

  • xx is a multiple of 33.
  • The decimal representation of xx contains 3.
  • Exactly three different digits are used in the decimal representation of xx.

Here, the decimal representation of an integer should not have unnecessary leading 0s.

在模 998244353998244353 意义下,求满足以下恰好一个条件的整数 xx 的个数,其中 1≤x≤N1 \leq x \leq N:

  • xx 是 33 的倍数;
  • xx 的十进制表示中包含数字 3;
  • xx 的十进制表示中恰好使用了三个不同的数字。

注意:整数的十进制表示不应包含多余的前导 0。

输入格式

The input is given from Standard Input in the following format:

NN

输入从标准输入中按以下格式给出:

NN

输出格式

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 11 to 4545, there are 1919 integers satisfying exactly one of the conditions in the problem statement, as follows.

  • There are 1010 integers satisfying only the first condition: 6,9,12,15,18,21,24,27,42,456, 9, 12, 15, 18, 21, 24, 27, 42, 45.
  • There are 99 integers satisfying only the second condition: 13,23,31,32,34,35,37,38,4313, 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 555555 and 10111011.
  • Integers satisfying only the second condition include 343343 and 553553.
  • Integers satisfying only the third condition include 10121012 and 704704.

Sample 3 Explanation:
There are no applicable integers.

Constraints

  • NN is an integer.
  • 1≤N<105001 \leq N < 10^{500}

样例 1 解释:
在 11 到 4545 的整数中,恰好满足题目所述三个条件中唯一一个条件的整数共有 1919 个,具体如下:

  • 仅满足第一个条件的整数有 1010 个:6,9,12,15,18,21,24,27,42,456, 9, 12, 15, 18, 21, 24, 27, 42, 45。
  • 仅满足第二个条件的整数有 99 个:13,23,31,32,34,35,37,38,4313, 23, 31, 32, 34, 35, 37, 38, 43。
  • 没有任何整数仅满足第三个条件。

样例 2 解释:
以下是符合条件的整数示例:

  • 仅满足第一个条件的整数包括 555555 和 10111011。
  • 仅满足第二个条件的整数包括 343343 和 553553。
  • 仅满足第三个条件的整数包括 10121012 和 704704。

样例 3 解释:
不存在符合条件的整数。

约束条件

  • NN 是一个整数。
  • 1≤N<105001 \leq N < 10^{500}

输入解题思路,AI测评打分。不知道怎么写?

首页