結果
| 問題 |
No.701 ひとりしりとり
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-09-17 11:13:33 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 395 ms / 2,000 ms |
| コード長 | 1,056 bytes |
| コンパイル時間 | 3,680 ms |
| コンパイル使用メモリ | 80,168 KB |
| 実行使用メモリ | 56,872 KB |
| 最終ジャッジ日時 | 2024-07-18 07:36:16 |
| 合計ジャッジ時間 | 5,933 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 12 |
ソースコード
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);
}
}
}