結果

問題 No.1915 Addition
ユーザー zezerozezero
提出日時 2022-04-29 21:56:04
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 723 bytes
コンパイル時間 3,083 ms
コンパイル使用メモリ 156,512 KB
実行使用メモリ 7,496 KB
最終ジャッジ日時 2023-09-11 13:01:53
合計ジャッジ時間 6,875 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
#include <set>
#include <queue>
#include <iomanip>
#include <cstring>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < int(n);i++)

int main(){
  int tt;
  cin >> tt;
  while(tt--){
    ll n;
    cin >> n;
    ll m = n;
    while(true){
      //printf("(n,m) = (%d,%d)\n",n,m);
      ll x = m;
      ll sn = n;
      while(x > 0){
        x/=10;
        sn *= 10;
      }
      if ((sn+m)%(n+m) == 0){
        //printf("(n,m) = (%d,%d)\n",n,m);
        cout << m << endl;
        break;
      }
      m += n;
    }
  }
  return 0;
}
0