結果

問題 No.2562 数字探しゲーム(緑以下コンver.)
ユーザー k82bk82b
提出日時 2023-12-02 18:04:07
言語 D
(dmd 2.106.1)
結果
AC  
実行時間 22 ms / 2,000 ms
コード長 964 bytes
コンパイル時間 3,533 ms
コンパイル使用メモリ 162,932 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2023-12-02 18:04:12
合計ジャッジ時間 4,466 ms
ジャッジサーバーID
(参考情報)
judge10 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

import std, core.bitop;
string[] _R;
void readM(T)(ref T x) { while (_R.empty) { _R = readln.chomp.split; } x = _R.front.to!T; _R.popFront; }
bool chmin(T)(ref T A, T B) { if (A > B) { A = B; return true; } else { return false; } }
bool chmax(T)(ref T A, T B) { if (A < B) { A = B; return true; } else { return false; } }
int lowerBound(T)(T[] A, T x) { int lo = -1, hi = cast(int)(A.length); while (hi - lo > 1) { int mid = lo + hi >> 1; (A[mid] < x ? lo : hi) = mid; } return hi; }
int upperBound(T)(T[] A, T x) { int lo = -1, hi = cast(int)(A.length); while (hi - lo > 1) { int mid = lo + hi >> 1; (A[mid] > x ? hi : lo) = mid; } return hi; }

void main() {
	int TE;
	TE.readM;
	foreach (_; 0 .. TE) {
		int M;
		M.readM;
		auto D = new int[9];
		foreach (i; 0 .. 9) {
			D[i].readM;
		}
		long x;
		foreach (i; 0 .. 9) {
			foreach (j; 0 .. D[i]) {
				x *= 10;
				x += i + 1;
			}
		}
		x *= 10 ^^ 9;
		if (x % M) {
			x += M - x % M;
		}
		writeln(x);
	}
}
0