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

Define the functionS(x) for x is a positive integer.S(x) equals to the sum of all digit of the decimal expression of xx. Please find a positive integer k that S(kx)%233=0.

Input Format

First line an integer T, indicates the number of test cases (T100). 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 200020002000. If there are more than one answer, output anyone is ok.

样例输入
1
1
样例输出
89999999999999999999999999
题目大意:

函数s(x)=x各位数字之和,给你一个x值,让你找到一个k满足s(x*k)%233=0

分析:

例如x=123,则令x*k=123123...123123(233个123),在左右两边均除以x(即除以123),最终得到结果

k=100100...1001(232个100,最后一位为1),模拟即可

#include<bits/stdc++.h>
#include <ctime>
using namespace std;
typedef long long ll;
const int MAXN = 1 * 1e5 + 500;
const ll M = 1e9 + 7;

char a[15];
int main()
{
    ///clock_t start_time = clock();

    ///clock_t end_time = clock();
    ///cout << "Running time is: " << static_cast<double>(end_time - start_time) / CLOCKS_PER_SEC * 1000 << "ms" << endl;
    std::ios::sync_with_stdio(false);
    int t;
    cin >> t;
    while (t--)
    {
        memset(a, 0, sizeof(a));
        cin >> a;
        int len = strlen(a);

        for (int i = 0; i < 232; i++)
        {
            cout << "1";
            for (int j = 1; j < len; j++)
            {
                cout << "0";
            }
        }
        cout << "1" << endl;
    }
    return 0;
}



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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值