結果

問題 No.701 ひとりしりとり
ユーザー cielciel
提出日時 2018-06-15 22:50:24
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 713 bytes
コンパイル時間 4,588 ms
コンパイル使用メモリ 81,192 KB
実行使用メモリ 73,908 KB
最終ジャッジ日時 2023-09-13 05:01:18
合計ジャッジ時間 7,984 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 149 ms
57,044 KB
testcase_01 AC 146 ms
56,764 KB
testcase_02 AC 148 ms
56,924 KB
testcase_03 AC 168 ms
56,660 KB
testcase_04 AC 169 ms
56,760 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 154 ms
56,684 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Random;
import java.util.Scanner;
public class main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String str = "abcdefghijklmnopqrstuvwxyz";
		Random r = new Random();
		String l = "";
		for (int i=0; i<n; i++) {
			StringBuffer sb = new StringBuffer();
			for (int j=0; j<10; j++) {
				int val = r.nextInt(str.length());
				sb.append(str.charAt(val));
			}
			if (sb.substring(sb.length()-1, sb.length()) == "n") {
				sb = sb.delete(sb.length()-1, sb.length());
			}
			if (i==n-1)
				System.out.println(l + sb + "n");
			else {
				System.out.println(l + sb);
				l = sb.substring(sb.length()-1, sb.length());
			}
		}
		
	}
}
0