結果

問題 No.701 ひとりしりとり
ユーザー HTmoji
提出日時 2018-06-19 17:54:56
言語 Java
(openjdk 23)
結果
AC  
実行時間 814 ms / 2,000 ms
コード長 594 bytes
コンパイル時間 3,236 ms
コンパイル使用メモリ 76,548 KB
実行使用メモリ 53,840 KB
最終ジャッジ日時 2024-06-30 17:17:38
合計ジャッジ時間 7,061 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Random;
import java.util.Scanner;

public class Sample {
	public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        int num = scan.nextInt();
        for(int i=0;i<num-1;i++) {
            System.out.println("a"+getRandomStr(10)+"a");
        }
        System.out.println("a"+getRandomStr(10)+"n");
    }

    static String getRandomStr(int num) {
    	String s = "";
    	for(int i=0;i<num;i++) {
            int value = new Random().nextInt(26) + 97;
            char c = (char) value;
            s += c;
    	}
    	return s;
    }
}
0