其他分享
首页 > 其他分享> > 2017 ACM-ICPC 亚洲区(西安赛区)网络赛C. Sum

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

作者:互联网

题目

 

Define the function S(x) for xx is a positive integer. S(x) equals to the sum of all digit of the decimal expression of x. 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≤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 2000. If there are more than one answer, output anyone is ok.

样例输入 


样例输出

89999999999999999999999999

思路 直接输出233个9。因为任何正整数乘以9的数位和都是9的倍数

AC代码

#include <iostream>
using namespace std;
int main()
{
    int T,n;
    cin>>T;
    while(T--){
        cin>>n;
        for(int i=1;i<=233;i++){
            cout<<9;
        }
        cout<<endl;
    }
    return 0;
}

标签:int,Sum,ACM,ICPC,indicates,test,answer,integer,line
来源: https://blog.csdn.net/qq_37291934/article/details/90348095