結果

問題 No.2562 数字探しゲーム(緑以下コンver.)
ユーザー viral8viral8
提出日時 2023-12-02 14:56:34
言語 Java21
(openjdk 21)
結果
AC  
実行時間 244 ms / 2,000 ms
コード長 728 bytes
コンパイル時間 2,391 ms
コンパイル使用メモリ 75,120 KB
実行使用メモリ 59,848 KB
最終ジャッジ日時 2023-12-02 14:56:42
合計ジャッジ時間 4,831 ms
ジャッジサーバーID
(参考情報)
judge13 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
54,120 KB
testcase_01 AC 50 ms
54,116 KB
testcase_02 AC 51 ms
54,108 KB
testcase_03 AC 49 ms
54,108 KB
testcase_04 AC 225 ms
59,848 KB
testcase_05 AC 229 ms
59,844 KB
testcase_06 AC 222 ms
59,732 KB
testcase_07 AC 244 ms
59,840 KB
testcase_08 AC 231 ms
59,748 KB
testcase_09 AC 213 ms
59,344 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
class Main{
	private static final BufferedReader br =
		new BufferedReader(new InputStreamReader(System.in));
	private static final PrintWriter out =
		new PrintWriter(System.out);
	public static void main(String[] args)throws IOException{

		int T = Integer.parseInt(br.readLine());
		while(T-->0){
			int M = Integer.parseInt(br.readLine());
			StringBuilder N = new StringBuilder();
			String[] str = br.readLine().split(" ");
			for(int i=0;i<9;i++)
				for(int j=0;j<Integer.parseInt(str[i]);j++)
					N.append(i+1);
			while(N.length()<18)
				N.append(0);
			long num = Long.parseLong(N.toString());
			num += (M-num%M)%M;
			out.println(num);
		}

		br.close();
		out.close();
	}
}
0