結果

問題 No.501 穴と文字列
ユーザー vjudge1
提出日時 2025-06-19 19:40:41
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 654 bytes
コンパイル時間 1,570 ms
コンパイル使用メモリ 160,888 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-06-19 19:40:44
合計ジャッジ時間 2,617 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

# include <bits/stdc++.h>
# define FILE(x) freopen(x".in", "r", stdin); freopen(x".out", "w", stdout);
using namespace std;
int n, d;
int main()
{
    //FILE("hole");
    cin >> n >> d;
    if (!d)
    {
        for (int i = 1; i <= n; i ++) cout << 'C';
    }
    else if (d >= n)
    {
        for (int i = 1; i <= 2 * n - d; i ++)
        {
            cout << 'A';
        }
        for (int i = 2 * n - d + 1; i <= n; i ++) cout << 'B';
    }
    else
    {
        for (int i = 1; i <= d; i ++)
        {
            cout << 'A';
        }
        for (int i = d + 1; i <= n; i ++)
        {
            cout << 'C';
        }
    }
    return 0;
}
0