結果

問題 No.1915 Addition
ユーザー yukster714yukster714
提出日時 2023-04-22 18:30:49
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 724 bytes
コンパイル時間 1,540 ms
コンパイル使用メモリ 163,100 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-04-24 21:27:45
合計ジャッジ時間 5,808 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 OLE -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
#define all(x) x.begin(),x.end() 
#define yesif(x) cout << ((x) ? "Yes": "No") << endl
#define myceil(a, b) (a+b-1)/b 
using namespace std;
typedef long long ll;

// diff: 1..7 (days)
// return : mmdd

int digit(ll n){
    int ret = 0;
    while(n>0) {
        n /=10;
        ret++;
    }
    return ret;
}

int main() {
    int t ; cin >> t;
    while(t--){
        ll n; cin >> n;
        for(ll m= 1; ; m++){
            ll a = n+m;
            ll b = n*pow(10,digit(m))+m;
            cout << "n=" << n << ";m=" << m << endl;
            if(b%a==0){
                cout <<m<< endl;
                break;
            } 
        }
    }
    return 0;
}

0