【 2017 ACM-ICPC 亚洲区(西安赛区)网络赛】C. Sum
2017-09-19 20:12
351 查看
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.
(T≤100).
Then Each line has a single integer x(1 \le x \le 1000000)
x(1≤x≤1000000)
indicates i-th test case.
200020002000.
If there are more than one answer, output anyone is ok.
分析:
例如x=123,则令x*k=123123...123123(233个123),在左右两边均除以x(即除以123),最终得到结果
k=100100...1001(232个100,最后一位为1),模拟即可
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 exceed200020002000.
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; }
相关文章推荐
- 【推导】计蒜客17116 2017 ACM-ICPC 亚洲区(西安赛区)网络赛 C. Sum
- 2017 ACM-ICPC 亚洲区(西安赛区)网络赛 C.Sum
- 计蒜客17116 Sum 找规律 2017 ACM-ICPC 亚洲区(西安赛区)网络赛
- 2017 ACM-ICPC 亚洲区(西安赛区)网络赛 C. Sum
- 2017 ACM-ICPC 亚洲区(西安赛区)网络赛 c题 sum
- 2017 ACM-ICPC 亚洲区(西安赛区)网络赛 C:sum<简单数学>
- C. Sum 数学/规律 2017 ACM-ICPC 亚洲区(西安赛区)网络赛
- 2017 ACM-ICPC 亚洲区(西安赛区)网络赛 C. Sum
- 2017 ACM-ICPC 亚洲区(西安赛区)网络赛 C.Sum(找规律)
- 2017 ACM-ICPC 亚洲区(西安赛区)网络赛 C. Sum
- 计蒜客 17116 Sum(2017 ACM-ICPC 亚洲区(西安赛区)网络赛 C)
- 2017 ACM-ICPC 亚洲区(西安赛区)网络赛 B Coin (概率计算)
- 2017 ACM-ICPC 亚洲区(西安赛区)网络赛
- 2017 ACM-ICPC 亚洲区(西安赛区)网络赛 F. Trig Function (切比雪夫多项式)
- 2017 ACM-ICPC 亚洲区(西安赛区)网络赛 B. Coin
- 2017 ACM-ICPC 亚洲区(西安赛区)网络赛 Coin(组合数)
- 计蒜客 17118 Maximum Flow(2017 ACM-ICPC 亚洲区(西安赛区)网络赛 E)
- 2017 ACM-ICPC 亚洲区(西安赛区)网络赛 B coin
- 2017 ACM-ICPC 亚洲区(西安赛区)网络赛 Coin 二项式定理
- 【 2017 ACM-ICPC 亚洲区(西安赛区)网络赛】 F. Trig Function