結果

問題 No.701 ひとりしりとり
ユーザー bluemeganebluemegane
提出日時 2018-09-06 09:55:27
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 281 ms / 2,000 ms
コード長 675 bytes
コンパイル時間 1,940 ms
コンパイル使用メモリ 55,024 KB
実行使用メモリ 18,672 KB
最終ジャッジ日時 2023-08-13 14:52:25
合計ジャッジ時間 3,172 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
14,648 KB
testcase_01 AC 52 ms
14,456 KB
testcase_02 AC 52 ms
14,660 KB
testcase_03 AC 54 ms
14,508 KB
testcase_04 AC 53 ms
14,560 KB
testcase_05 AC 52 ms
14,600 KB
testcase_06 AC 53 ms
14,600 KB
testcase_07 AC 52 ms
14,660 KB
testcase_08 AC 53 ms
14,536 KB
testcase_09 AC 54 ms
14,600 KB
testcase_10 AC 76 ms
15,680 KB
testcase_11 AC 281 ms
18,672 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        if (n == 1) { Console.WriteLine("n"); goto end; }
        Console.WriteLine("a");
        for (int i = 1; i < n -1; i++)
            Console.WriteLine("a" + getS(i) + "a");
        Console.WriteLine("a" + getS(n -1) + "n");
        end:;
    }
    public static string getS(int n)
    {
        var a = "abcdefghijklmnopqrstuvwxyz";
        var ans = new char[4];
        for (int i = 3; i >= 1; i--)
        {
            ans[i] = a[n % 26];
            n /= 26;
        }
        ans[0] = a[n % 26];
        return new string(ans);
    }
}
0