2017 ACM-ICPC 亚洲区(西安赛区)网络赛C. Sum
来源:互联网 发布:阿里云iot事业部 编辑:程序博客网 时间:2024/06/05 19:41
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
这道题目的意思是说有一个函数S(x)的值是一个数的十进制表示,所有位数之和。
现在S(k*x)%233=0;问你K的值是多少。
当X=1的时候,K=89999999999999999999999999,S(k*x)=233
就符合条件。
这道题目就是个脑洞题,想到构造方法就可以了。
我们想到的构造方法是,1001*123=123123
那么我们就只需要233个123就一定是满足条件的
那么我们只需要233个1001这样的循环节,在乘以X以后就变成了一个233个123的数。
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(k*x)%233=0;问你K的值是多少。
当X=1的时候,K=89999999999999999999999999,S(k*x)=233
就符合条件。
这道题目就是个脑洞题,想到构造方法就可以了。
我们想到的构造方法是,1001*123=123123
那么我们就只需要233个123就一定是满足条件的
那么我们只需要233个1001这样的循环节,在乘以X以后就变成了一个233个123的数。
这样的数的位数和一定是可以整除233的。
#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
- 计蒜客 17116 Sum(2017 ACM-ICPC 亚洲区(西安赛区)网络赛 C)
- 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(找规律)
- 2017 ACM-ICPC 亚洲区(西安赛区)网络赛
- 2017 ACM-ICPC 亚洲区(西安赛区)网络赛
- 2017 ACM-ICPC 亚洲区(西安赛区)网络赛
- 2017 ACM-ICPC 亚洲区(西安赛区)网络赛
- 执行脚本的C程序
- CronTrigger 和Cron表达式生成器 定时任务调度
- 访问的h5中文乱码问题
- php push技术转载
- 遗传算法过程
- 2017 ACM-ICPC 亚洲区(西安赛区)网络赛C. Sum
- java,内存溢出和栈溢出实例
- burpsuite 安装和使用
- N!
- 012、成员变量和局部变量
- java时间计算
- 【ES6】Promise
- Springboot系列:Springboot与Thymeleaf模板引擎整合基础教程(附源码)
- 2018科大讯飞校招笔试题