結果

問題 No.501 穴と文字列
ユーザー qazqaz
提出日時 2017-05-21 15:43:49
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 2,003 bytes
コンパイル時間 2,798 ms
コンパイル使用メモリ 109,744 KB
実行使用メモリ 48,320 KB
最終ジャッジ日時 2023-08-21 07:24:30
合計ジャッジ時間 19,002 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,802 ms
44,172 KB
testcase_01 AC 1,751 ms
44,240 KB
testcase_02 AC 57 ms
20,708 KB
testcase_03 AC 57 ms
22,568 KB
testcase_04 AC 57 ms
20,692 KB
testcase_05 AC 58 ms
22,728 KB
testcase_06 AC 56 ms
20,628 KB
testcase_07 AC 57 ms
20,716 KB
testcase_08 AC 56 ms
20,568 KB
testcase_09 AC 57 ms
22,724 KB
testcase_10 AC 57 ms
20,688 KB
testcase_11 AC 57 ms
22,724 KB
testcase_12 AC 56 ms
20,748 KB
testcase_13 AC 58 ms
20,720 KB
testcase_14 AC 58 ms
22,620 KB
testcase_15 AC 56 ms
20,724 KB
testcase_16 AC 57 ms
22,628 KB
testcase_17 AC 56 ms
22,728 KB
testcase_18 TLE -
testcase_19 TLE -
testcase_20 TLE -
testcase_21 TLE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

public class Program
{
    public static void Main() {
        var so = new Solver();
        so.Solve();
    }
}

public class Solver
{
    private readonly Reader reader;
    private readonly TextWriter writer;

    public Solver() {
        reader = new Reader(Console.In);
        writer = Console.Out;
    }

    public Solver(string input, string  output) {
        reader = new Reader(new StreamReader(input));
        writer = new StreamWriter(output);
    }

    public void Solve() {
        int N = reader.RInt();
        int D = reader.Int();

        int ana = 0;
        string ans = "";
        for (int i = 0; i < N; i++) {
            if (ana == D) {
                ans += "C";
            } else if (ana + (N - i) * 2 == D) {
                ans += "B";
                ana += 2;
            } else {
                ans += "A";
                ana++;
            }
        }

        writer.WriteLine(ans);
        writer.Flush();
    }
}

public class Reader
{
    private readonly TextReader reader;
    private readonly char separator = ' ';
    private string[] A = new string[0];
    private int i;

    public Reader(TextReader r) {
        reader = r;
    }

    public string String() { return Set(); }
    public int Int() { return int.Parse(Set()); }
    public long Long() { return long.Parse(Set()); }
    public decimal Decimal() { return decimal.Parse(Set()); }

    public string RString() { return RSet(); }
    public int RInt() { return int.Parse(RSet()); }
    public long RLong() { return long.Parse(RSet()); }
    public decimal RDecimal() { return decimal.Parse(RSet()); }

    public int[] IntArray() { return A.Select(x => int.Parse(x)).ToArray(); }

    private void Read() {
        string line = reader.ReadLine();

        A = line.Split(separator);
        i = 0;
    }

    private string Set() { return A[i++]; }
    private string RSet() { Read(); return A[i++]; }
}
0