結果

問題 No.701 ひとりしりとり
ユーザー GrenacheGrenache
提出日時 2018-09-17 11:13:33
言語 Java21
(openjdk 21)
結果
AC  
実行時間 488 ms / 2,000 ms
コード長 1,056 bytes
コンパイル時間 3,598 ms
コンパイル使用メモリ 76,200 KB
実行使用メモリ 69,000 KB
最終ジャッジ日時 2023-09-25 09:18:12
合計ジャッジ時間 6,861 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,716 KB
testcase_01 AC 121 ms
55,732 KB
testcase_02 AC 122 ms
55,788 KB
testcase_03 AC 125 ms
55,480 KB
testcase_04 AC 123 ms
55,772 KB
testcase_05 AC 127 ms
55,528 KB
testcase_06 AC 122 ms
55,508 KB
testcase_07 AC 127 ms
56,340 KB
testcase_08 AC 130 ms
54,220 KB
testcase_09 AC 160 ms
55,704 KB
testcase_10 AC 190 ms
57,976 KB
testcase_11 AC 488 ms
69,000 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;


public class Main_yukicoder701 {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int n = sc.nextInt();

		Random rnd = new Random();
		
		Set<Integer> hs = new HashSet<>();
		for (int i = 0; i < n; i++) {
			int tmp = rnd.nextInt(1_000_000_000) + 1;
			while (hs.contains(tmp)) {
				tmp = rnd.nextInt(1_000_000_000) + 1;
			}
			hs.add(tmp);
			
			pr.print('a');
			
			while (tmp > 0) {
				pr.print((char)('a' + tmp % 10));
				tmp /= 10;
			}
			
			if (i < n - 1) {
				pr.print('a');
			} else {
				pr.print('n');
			}
			pr.println();
		}
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(INPUT == null ? System.in : new ByteArrayInputStream(INPUT.getBytes()));
		pr = new Printer(System.out);

		solve();

//		pr.close();
		pr.flush();
//		sc.close();
	}

	static String INPUT = null;

	private static class Printer extends PrintWriter {
		Printer(OutputStream out) {
			super(out);
		}
	}
}
0