結果

問題 No.501 穴と文字列
ユーザー mori_chibimori_chibi
提出日時 2017-08-21 10:00:24
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 1,687 ms / 2,000 ms
コード長 1,173 bytes
コンパイル時間 1,193 ms
コンパイル使用メモリ 108,888 KB
実行使用メモリ 51,232 KB
最終ジャッジ日時 2024-04-23 01:33:30
合計ジャッジ時間 14,087 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,376 ms
49,312 KB
testcase_01 AC 1,327 ms
49,184 KB
testcase_02 AC 22 ms
23,900 KB
testcase_03 AC 22 ms
24,028 KB
testcase_04 AC 21 ms
24,244 KB
testcase_05 AC 22 ms
23,900 KB
testcase_06 AC 22 ms
23,900 KB
testcase_07 AC 22 ms
24,032 KB
testcase_08 AC 22 ms
23,904 KB
testcase_09 AC 23 ms
23,644 KB
testcase_10 AC 22 ms
23,772 KB
testcase_11 AC 23 ms
24,088 KB
testcase_12 AC 22 ms
23,904 KB
testcase_13 AC 21 ms
24,116 KB
testcase_14 AC 21 ms
26,268 KB
testcase_15 AC 21 ms
23,976 KB
testcase_16 AC 22 ms
25,884 KB
testcase_17 AC 21 ms
26,004 KB
testcase_18 AC 1,667 ms
49,188 KB
testcase_19 AC 1,677 ms
51,232 KB
testcase_20 AC 1,630 ms
49,316 KB
testcase_21 AC 1,687 ms
47,260 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

namespace HoleString
{
    class Program
    {
        static void Main(string[] args)
        {
            const string h0 = "C";
            const string h1 = "A";
            const string h2 = "B";
            string[] param = Console.ReadLine().Split(' ');
            int n = int.Parse(param[0]);
            int d = int.Parse(param[1]);
            int num0, num1, num2;
            string r = null;
            if (d < 1)
            {
                num0 = n;
                num1 = 0;
                num2 = 0;
            }
            else if( n < d)
            {
                num0 = 0;
                num1 = 2 * n - d;
                num2 = d - n;
            }
            else
            {
                num0 = n - d;
                num1 = d;
                num2 = 0;
            }
            for (int i = 0; i < num1; i++)
            {
                r = r + h1;
            }
            for (int i = 0; i < num2; i++)
            {
                r = r + h2;
            }
            for (int i = 0; i < num0; i++)
            {
                r = r + h0;
            }
            Console.WriteLine(r);
        }
    }
}
0