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

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(kx)%233=0.

Input Format

First line an integer TT, indicates the number of test cases (T \le 100T100). Then Each line has a single integer 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 exceed 20002000. If there are more than one answer, output anyone is ok.

样例输入
1
1
样例输出
89999999999999999999999999

题目大意:S(x)为求x用十进制数表达时各个位置上的数之和,比如S(123)=1+2+3=6;现在让你输入一个x,求一个k使S(k*x)%233=0;

思路:很很很巧妙;S(9)=9=1*9 S(2*9)=1+8=9=1*9 S(3*9)=2+7=9=1*9;

S(99)=9+9=2*9 S(99*2)=1+9+8=18=9*2;

S(999)=9+9+9=27; S(999*3)=S(2997)=9*3

由上可以知道规律当99999....9(233个9)乘以任何一个数它的S都是233*9;

所以直接输出233个9就A了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值