結果
問題 |
No.2562 数字探しゲーム(緑以下コンver.)
|
ユーザー |
|
提出日時 | 2024-11-21 22:54:49 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 41 ms / 2,000 ms |
コード長 | 527 bytes |
コンパイル時間 | 1,958 ms |
コンパイル使用メモリ | 193,376 KB |
最終ジャッジ日時 | 2025-02-25 05:49:20 |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 10 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(false); cin.tie(0); int T; cin >> T; while(T--){ int m; cin >> m; ll d = 1'000'000'000ll, ans = 0; for(int i = 1; i < 10; i++){ int c; cin >> c; while(c--){ ans += d * i; d *= 10; } } ans += (m - ans % m) % m; if (ans == 0) ans = m; cout << ans << '\n'; } }