2017 ACM-ICPC (西安赛区) C-Sum
来源:互联网 发布:贤者时间 知乎 编辑:程序博客网 时间:2024/06/05 07:26
问题描述:
Define the function S(x)S(x) for xx is a positive integer. S(x)S(x) equals to the sum of all digit of the decimal expression of xx. Please find a positive integer kk that S(k*x)\%233=0S(k∗x)%233=0.
Input Format
First line an integer TT, indicates the number of test cases (T \le 100T≤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 20002000. If there are more than one answer, output anyone is ok.
样例输入
1
1
样例输出
89999999999999999999999999
Input Format
First line an integer TT, indicates the number of test cases (T \le 100T≤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 20002000. If there are more than one answer, output anyone is ok.
样例输入
1
1
样例输出
89999999999999999999999999
题目题意:题目给了一个函数S(x) 其中S(x)表示x的每个位数的和。题目给我们一个数x,让我们求S(k*x) % 233=0,输出任意k即可。
题目分析:这个题目脑洞了好久,一直在想怎么构造数X使得S(X) %233=0,终于有了眉目。
我们构造数 如下
100..00100..00100..001 (其中有233个1,中间的0的个数等于x的位数-1.
例如
1000100010001....10001 *6544=6544 6544 6544 6544 6544....6544 6544 有233个6544
一定满足题意.
代码如下:
#include<iostream>#include<cstdio>#include<cstring>#include<cmath>using namespace std;int main(){ int t; scanf("%d",&t); while (t--) { int x; scanf("%d",&x); int len=0; while (x) { len++; x=x/10; } len--; for (int i=1;i<=232;i++) { printf("1"); for (int j=1;j<=len;j++) printf("0"); } printf("1\n"); } return 0;}
阅读全文
0 0
- 2017 ACM-ICPC (西安赛区) C-Sum
- 2017ACM-ICPC西安赛区
- Sum-2017 ACM-ICPC 亚洲区(西安赛区)
- C.Sum 2017 ACM-ICPC 亚洲区(西安赛区)网络赛
- 2017 ACM-ICPC 亚洲区(西安赛区)网络赛C. Sum
- 2017 ACM-ICPC 亚洲区(西安赛区)网络赛 C. Sum
- 2017 ACM-ICPC 亚洲区(西安赛区)网络赛 C.Sum(找规律)
- 2017 ACM-ICPC 亚洲区(西安赛区)网络赛 C Sum
- 2017 ACM-ICPC 亚洲区(西安赛区)网络赛 c题 sum
- 2017 ACM-ICPC 亚洲区(西安赛区)网络赛 C.Sum
- 2017 ACM-ICPC 亚洲区(西安赛区)网络赛 C. Sum
- 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(找规律)
- 计蒜客 17116 Sum(2017 ACM-ICPC 亚洲区(西安赛区)网络赛 C)
- 2017 ACM-ICPC(西安赛区) B-Coin
- JS数组去重
- PHP xdebug_debug_zval debug_zval_dump 使用
- oninput、onchange与onpropertychange事件的用法和区别
- 使用jQuery做网页定位导航特效(下)
- 一种二叉树遍历方法
- 2017 ACM-ICPC (西安赛区) C-Sum
- Online Judge
- Uboot代码学习实践验证之Linux下烧uboot
- cs/bs区别
- Unity ios 清掉推送缓存问题
- Akka入门手册
- 第6章 堆排序
- 有关JAVA中collection和set和list的用法,以及元素的升序排序方法
- RobotFramwork(二)chrome 自动化用例遇到的问题