2017 ACM-ICPC 亚洲区(西安赛区)网络赛 C:sum<简单数学>

来源:互联网 发布:易企秀电脑版 mac 编辑:程序博客网 时间:2024/06/07 00:39

Define the function S(x)S(x)S(x) for xxx is a positive integer. S(x)S(x)S(x) equals to the sum of all digit of the decimal expression of xxx. Please find a positive integer kkk that S(k∗x)%233=0S(k*x)\%233=0S(kx)%233=0.

Input Format

First line an integer TTT, indicates the number of test cases (T≤100T \le 100T100). Then Each line has a single integer x(1≤x≤1000000)x(1 \le x \le 1000000)x(1x1000000) 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.

样例输入

11

样例输出

89999999999999999999999999

题目来源

2017 ACM-ICPC 亚洲区(西安赛区)网络赛

网络赛的一眼题,我们需要找到一个k使得k*x之后的值,每一位上的值相加是233的倍数

那么我们可以想到,如果能够造一个k使得k*x上的每一位之和是x*233就行啦

再仔细看题,x最多取到1000000,所以我们打印233个0000001就行了,这样使得最后得到的每一位之和就是233个x


#include <iostream>#include<functional>#include <cstdio>#include<set>#include<cmath>#include<cstring>#include<algorithm>#include<queue>using namespace std;int main(){    int t;    scanf("%d",&t);    while(t--)    {        int n;        scanf("%d",&n);        printf("1");//就不打印前导0了        for(int i=2; i<=233;i++)            printf("0000001");        printf("\n");    }    return 0;}



阅读全文
0 0