結果

問題 No.701 ひとりしりとり
ユーザー katsumikatsumi
提出日時 2019-01-28 14:58:05
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,158 bytes
コンパイル時間 2,678 ms
コンパイル使用メモリ 77,700 KB
実行使用メモリ 52,764 KB
最終ジャッジ日時 2024-04-15 04:24:11
合計ジャッジ時間 9,701 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 141 ms
48,092 KB
testcase_02 AC 138 ms
41,276 KB
testcase_03 AC 140 ms
41,488 KB
testcase_04 AC 139 ms
48,660 KB
testcase_05 AC 140 ms
42,160 KB
testcase_06 AC 142 ms
41,276 KB
testcase_07 AC 143 ms
41,412 KB
testcase_08 AC 145 ms
41,540 KB
testcase_09 AC 188 ms
41,544 KB
testcase_10 AC 268 ms
43,584 KB
testcase_11 AC 623 ms
51,736 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
public class Main {
	
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        
        char[] s1 = "aaaaaz".toCharArray();
        char[] s2 = "zaaaaa".toCharArray();
        
        if (N == 1) {
        	System.out.println("n");
        }
        
        int count = 0;
        for (char i1 = 'a'; i1 <= 'z'; i1++) {
        	for (char i2 = 'a'; i2 < 'z'; i2++) {
        		for (char i3 = 'a'; i3 < 'z'; i3++) {
        			for (char i4 = 'a'; i4 < 'z'; i4++) {
        				if (count % 2 == 0) {
        					s1[1] = i1;
        					s1[2] = i2;
        					s1[3] = i3;
        					s1[4] = i4;
        					System.out.println(new String(s1));
        				} else {
        					s2[1] = i1;
        					s2[2] = i2;
        					s2[3] = i3;
        					s2[4] = i4;
        					System.out.println(new String(s2));
        				}
        				
        				count++;
        				if (count == N-1) {
        					System.out.println(count % 2 == 0 ? "an": "zn");
        					return;
        				}
        			}
        		}
        	}
        }

    }
}

0