結果

問題 No.701 ひとりしりとり
ユーザー katsumikatsumi
提出日時 2019-01-28 14:56:09
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,083 bytes
コンパイル時間 2,103 ms
コンパイル使用メモリ 77,344 KB
実行使用メモリ 66,108 KB
最終ジャッジ日時 2024-04-15 04:20:51
合計ジャッジ時間 8,090 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 126 ms
54,408 KB
testcase_02 AC 127 ms
53,984 KB
testcase_03 AC 133 ms
54,036 KB
testcase_04 AC 126 ms
53,872 KB
testcase_05 AC 132 ms
54,300 KB
testcase_06 AC 130 ms
54,176 KB
testcase_07 AC 129 ms
53,848 KB
testcase_08 AC 133 ms
54,348 KB
testcase_09 AC 174 ms
54,344 KB
testcase_10 AC 253 ms
55,500 KB
testcase_11 AC 586 ms
63,504 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();
        
        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