結果
問題 |
No.2562 数字探しゲーム(緑以下コンver.)
|
ユーザー |
![]() |
提出日時 | 2023-12-07 14:25:26 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 27 ms / 2,000 ms |
コード長 | 599 bytes |
コンパイル時間 | 2,098 ms |
コンパイル使用メモリ | 194,332 KB |
最終ジャッジ日時 | 2025-02-18 08:57:25 |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 10 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; void solve(){ ll M, d, K; const ll inf = 2e18; string S=""; cin >> M; for (int i=1; i<=9; i++){ cin >> d; S += string(d, char(i+'0')); } S += string(9, '0'); K = stoll(S); ll l=0, r=inf/M, c; while(r-l>1){ c = (l+r)/2; if (c * M >= K) r=c; else l=c; } cout << r*M << endl; } int main(){ cin.tie(nullptr); ios_base::sync_with_stdio(false); int T; cin >> T; while(T){ T--; solve(); } return 0; }