結果

問題 No.2562 数字探しゲーム(緑以下コンver.)
ユーザー takumi152takumi152
提出日時 2023-12-02 15:02:22
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 24 ms / 2,000 ms
コード長 927 bytes
コンパイル時間 1,047 ms
コンパイル使用メモリ 88,664 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2023-12-02 15:02:25
合計ジャッジ時間 2,196 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <stack>

using namespace std;

typedef long long int ll;
typedef pair<int, int> Pii;

const ll mod = 998244353;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int t;
  cin >> t;
  vector<ll> m(t);
  vector<vector<ll>> d(t, vector<ll>(9));
  for (int i = 0; i < t; i++) {
    cin >> m[i];
    for (auto &dn: d[i]) cin >> dn;
  }

  vector<ll> ans;
  for (int i = 0; i < t; i++) {
    ll mult_1e9 = 0;
    for (int j = 0; j < 9; j++) {
      for (int k = 0; k < d[i][j]; k++) {
        mult_1e9 = mult_1e9 * 10 + (j + 1);
      }
    }
    ll ans_hi = mult_1e9 * 1000000000LL;
    ll ans_lo = (m[i] - ans_hi % m[i]) % 1000000000LL;
    if (ans_hi + ans_lo == 0) ans_lo = m[i];
    ans.push_back(ans_hi + ans_lo);
  }

  for (auto &x: ans) cout << x << endl;

  return 0;
}
0