結果

問題 No.701 ひとりしりとり
ユーザー YamaKasaYamaKasa
提出日時 2018-10-01 15:42:52
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 725 bytes
コンパイル時間 2,056 ms
コンパイル使用メモリ 73,824 KB
実行使用メモリ 64,368 KB
最終ジャッジ日時 2023-08-02 14:12:30
合計ジャッジ時間 5,337 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,676 KB
testcase_01 AC 123 ms
55,668 KB
testcase_02 AC 122 ms
55,800 KB
testcase_03 AC 125 ms
55,744 KB
testcase_04 AC 124 ms
55,728 KB
testcase_05 AC 125 ms
55,936 KB
testcase_06 AC 127 ms
56,024 KB
testcase_07 AC 126 ms
55,792 KB
testcase_08 AC 131 ms
55,736 KB
testcase_09 AC 162 ms
56,504 KB
testcase_10 AC 259 ms
59,300 KB
testcase_11 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		scan.close();
		String[]w = new String[n];
		char[]c = new char[26];
		for(int i = 0; i < 26; i++) {
			c[i] =  (char) ('a' + i);
		}
		int idx = 0;
		loop: for(int i = 0; i < 26; i++) {
			for(int j = 0; j < 26; j++) {
				for(int k = 0; k < 26; k++) {
					for(int l = 0; k < 26; k++) {
						char []t = {'a', c[i], c[j], c[k], c[l], 'a'};
						if(idx == n - 1) {
							t[5] = 'n';
						}
						w[idx] = String.valueOf(t);
						idx ++;
						if(idx == n) {
							break loop;
						}
					}
				}
			}
		}
		for(String s: w) {
			System.out.println(s);
		}
	}
}
0