結果

問題 No.2562 数字探しゲーム(緑以下コンver.)
ユーザー tnakao0123tnakao0123
提出日時 2023-12-03 23:18:17
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 13 ms / 2,000 ms
コード長 635 bytes
コンパイル時間 458 ms
コンパイル使用メモリ 41,536 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2023-12-03 23:18:18
合計ジャッジ時間 1,419 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 2562.cc:  No.2562 数字探しゲーム(緑以下コンver.) - yukicoder
 */

#include<cstdio>
#include<algorithm>
 
using namespace std;

/* constant */

/* typedef */

typedef long long ll;

/* global variables */

int ds[10];

/* subroutines */

/* main */

int main() {
  int tn;
  scanf("%d", &tn);

  while (tn--) {
    int m;
    scanf("%d", &m);

    ll x = 0;
    for (int i = 1; i <= 9; i++) {
      scanf("%d", ds + i);
      for (int j = 0; j < ds[i]; j++) x = x * 10 + i;
    }
    x *= 1000000000;

    int r = x % m;
    if (r > 0) x += m - r;

    printf("%lld\n", x);
  }

  return 0;
}
0