結果

問題 No.501 穴と文字列
コンテスト
ユーザー mori_chibi
提出日時 2017-08-21 10:00:24
言語 C#(csc)
(csc 3.9.0)
コンパイル:
csc -langversion:latest -unsafe -warn:0 -o+ /r:System.Numerics.dll _filename_ -out:a.exe
実行:
/usr/bin/mono a.exe
結果
AC  
実行時間 1,158 ms / 2,000 ms
コード長 1,173 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 492 ms
コンパイル使用メモリ 104,448 KB
実行使用メモリ 41,600 KB
最終ジャッジ日時 2026-05-02 11:39:44
合計ジャッジ時間 8,958 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #
raw source code

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