結果

問題 No.701 ひとりしりとり
ユーザー tentententen
提出日時 2020-10-14 09:21:31
言語 Java21
(openjdk 21)
結果
AC  
実行時間 200 ms / 2,000 ms
コード長 502 bytes
コンパイル時間 4,215 ms
コンパイル使用メモリ 71,680 KB
実行使用メモリ 58,968 KB
最終ジャッジ日時 2023-09-28 00:30:21
合計ジャッジ時間 5,065 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,888 KB
testcase_01 AC 122 ms
55,752 KB
testcase_02 AC 125 ms
55,816 KB
testcase_03 AC 122 ms
55,924 KB
testcase_04 AC 121 ms
55,904 KB
testcase_05 AC 121 ms
55,740 KB
testcase_06 AC 122 ms
56,080 KB
testcase_07 AC 124 ms
55,832 KB
testcase_08 AC 125 ms
55,668 KB
testcase_09 AC 128 ms
55,760 KB
testcase_10 AC 145 ms
56,096 KB
testcase_11 AC 200 ms
58,968 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int n = sc.nextInt();
    	StringBuilder sb = new StringBuilder();
    	for (int i = 0; i < n - 1; i++) {
    	    sb.append('a');
    	    int count = i;
    	    while (count > 0) {
    	        sb.append((char)('a' + count % 26));
    	        count /= 26;
    	    }
    	    sb.append('a').append("\n");
    	}
    	sb.append("an");
    	System.out.println(sb);
	}
}
0