結果

問題 No.701 ひとりしりとり
ユーザー katsumikatsumi
提出日時 2019-01-28 14:16:52
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 779 bytes
コンパイル時間 1,922 ms
コンパイル使用メモリ 74,844 KB
実行使用メモリ 67,856 KB
最終ジャッジ日時 2024-04-15 03:16:11
合計ジャッジ時間 7,464 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
54,116 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 135 ms
54,324 KB
testcase_05 WA -
testcase_06 AC 136 ms
54,248 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 RE -
権限があれば一括ダウンロードができます

ソースコード

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[] s = "aaaaaaaaaaaaaaaaaaaz".toCharArray();
        
        int index = 1;
        for (int i = 0; i < N-1; i++) {
        	if (s[index] == 'z') {
        		index++;
        		s[index]++;
        	} else {
        		s[index]++;
        	}
        	
        	if (i % 2 == 0) {
        		System.out.println(new String(s));
        	} else {
        		for (int j = s.length-1; 0 <= j; j--) {
        			System.out.print(s[j]);
        		}
        		System.out.println();
        	}
        }
        
        s[s.length-1] = 'n';
        System.out.println(new String(s));
    }
}

0