Define the functionS(x) for x is a positive integer.S(x) equals to the sum of all digit of the decimal expression of xx. Please find a positive integer k that S(k∗x)%233=0.
Input Format
First line an integer T, indicates the number of test cases
(T≤100).
Then Each line has a single integer x(1 \le x \le 1000000)
x(1≤x≤1000000)
indicates i-th test case.
Output Format
For each test case, print an integer in a single line indicates the answer. The length of the answer should not exceed 200020002000. If there are more than one answer, output anyone is ok.
样例输入
1
1
样例输出
89999999999999999999999999
题目大意:
函数s(x)=x各位数字之和,给你一个x值,让你找到一个k满足s(x*k)%233=0
分析:
例如x=123,则令x*k=123123...123123(233个123),在左右两边均除以x(即除以123),最终得到结果
k=100100...1001(232个100,最后一位为1),模拟即可
#include<bits/stdc++.h>
#include <ctime>
using namespace std;
typedef long long ll;
const int MAXN = 1 * 1e5 + 500;
const ll M = 1e9 + 7;
char a[15];
int main()
{
///clock_t start_time = clock();
///clock_t end_time = clock();
///cout << "Running time is: " << static_cast<double>(end_time - start_time) / CLOCKS_PER_SEC * 1000 << "ms" << endl;
std::ios::sync_with_stdio(false);
int t;
cin >> t;
while (t--)
{
memset(a, 0, sizeof(a));
cin >> a;
int len = strlen(a);
for (int i = 0; i < 232; i++)
{
cout << "1";
for (int j = 1; j < len; j++)
{
cout << "0";
}
}
cout << "1" << endl;
}
return 0;
}
本文介绍了一个数学问题的解决方法,该问题是寻找一个正整数k,使得S(x*k)模233等于0,其中S(x)定义为x的十进制表示中所有数字之和。文章提供了一种通过构造特定形式的k来解决问题的有效策略。
网络赛】C. Sum&spm=1001.2101.3001.5002&articleId=78034058&d=1&t=3&u=886f1d491cd94b119451938cb024dfc0)
23万+

被折叠的 条评论
为什么被折叠?



