CF1194G.Another Meme Problem

省选/NOI-

通过率:0%

时间限制:4.00s

内存限制:512MB

AC君温馨提醒

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

题目描述

Let's call a fraction xy\frac{x}{y} good if there exists at least one another fraction x′y′\frac{x'}{y'} such that xy=x′y′\frac{x}{y} = \frac{x'}{y'}, 1≤x′,y′≤91 \le x', y' \le 9, the digit denoting x′x' is contained in the decimal representation of xx, and the digit denoting y′y' is contained in the decimal representation of yy. For example, 2613\frac{26}{13} is a good fraction, because 2613=21\frac{26}{13} = \frac{2}{1}.

You are given an integer number nn. Please calculate the number of good fractions xy\frac{x}{y} such that 1≤x≤n1 \le x \le n and 1≤y≤n1 \le y \le n. The answer may be really large, so print it modulo 998244353998244353.

我们称一个分数 xy\frac{x}{y} 是“好的”,如果存在至少另一个分数 x′y′\frac{x'}{y'},满足:xy=x′y′\frac{x}{y} = \frac{x'}{y'},且 1≤x′,y′≤91 \le x', y' \le 9,同时表示 x′x' 的数字出现在 xx 的十进制表示中,表示 y′y' 的数字出现在 yy 的十进制表示中。例如,2613\frac{26}{13} 是一个好分数,因为 2613=21\frac{26}{13} = \frac{2}{1}。

给定一个整数 nn,请计算满足 1≤x≤n1 \le x \le n 且 1≤y≤n1 \le y \le n 的好分数 xy\frac{x}{y} 的个数。答案可能非常大,请对 998244353998244353 取模后输出。

输入格式

The only line of the input contains one integer nn (1≤n<101001 \le n \lt 10^{100}).

输入仅有一行,包含一个整数 nn(1≤n<101001 \le n \lt 10^{100})。

输出格式

Print the number of good fractions xy\frac{x}{y} such that 1≤x≤n1 \le x \le n and 1≤y≤n1 \le y \le n. The answer may be really large, so print it modulo 998244353998244353.

输出满足 1≤x≤n1 \le x \le n 且 1≤y≤n1 \le y \le n 的“好分数” xy\frac{x}{y} 的个数。答案可能非常大,因此请对 998244353998244353 取模后输出。

输入输出样例

  • 输入#1

    42

    输出#1

    150
  • 输入#2

    3141592653589793238462643383279

    输出#2

    459925407

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

首页