結果

問題 No.964 2020
ユーザー uwiuwi
提出日時 2020-01-13 19:07:48
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,380 bytes
コンパイル時間 4,274 ms
コンパイル使用メモリ 76,864 KB
実行使用メモリ 57,940 KB
最終ジャッジ日時 2023-08-23 11:13:02
合計ジャッジ時間 6,549 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
55,448 KB
testcase_01 AC 127 ms
55,912 KB
testcase_02 AC 119 ms
55,616 KB
testcase_03 AC 120 ms
55,572 KB
testcase_04 WA -
testcase_05 AC 119 ms
55,840 KB
testcase_06 WA -
testcase_07 AC 128 ms
55,664 KB
testcase_08 WA -
testcase_09 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

package contest200113;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Random;
import java.util.Scanner;

// 異物混入
public class A1 {
	static Scanner in;
	static PrintWriter out;
	static String INPUT = "";
	
	static void solve()
	{
		int n = ni();
		if(!(1 <= n && n <= 10))throw new RuntimeException();
		int[] f = new int[10];
		Random gen = new Random();
		for(int i = 0;i < n;i++) {
			while(true) {
				int v = gen.nextInt(10);
				if(i == 0 && v == 0)continue;
				if(f[v] == 0) {
					f[v] += n;
					break;
				}
			}
		}
		
		for(int i = 1;i <= 9;i++) {
			if(f[i] > 0) {
				out.print(i);
				f[i]--;
				break;
			}
		}
		
		for(int i = 0;i < n*n-1;i++) {
			while(true) {
				int x = gen.nextInt(10);
				if(f[x] > 0) {
					f[x]--;
					if(x == 9) {
						out.print(".");
					}else {
						out.print(x);
					}
					break;
				}
			}
		}
		out.println();
	}
	
	public static void main(String[] args) throws Exception
	{
		in = INPUT.isEmpty() ? new Scanner(System.in) : new Scanner(INPUT);
		out = new PrintWriter(System.out);
		
		solve();
		out.flush();
	}
	
	static int ni() { return Integer.parseInt(in.next()); }
	static long nl() { return Long.parseLong(in.next()); }
	static double nd() { return Double.parseDouble(in.next()); }
	static void tr(Object... o) { if(INPUT.length() != 0)System.out.println(Arrays.deepToString(o)); }
}
0