結果

問題 No.2562 数字探しゲーム(緑以下コンver.)
ユーザー takumi152
提出日時 2023-12-02 15:02:22
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 25 ms / 2,000 ms
コード長 927 bytes
コンパイル時間 1,110 ms
コンパイル使用メモリ 90,764 KB
最終ジャッジ日時 2025-02-18 04:10:31
ジャッジサーバーID
(参考情報)
judge2 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

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