結果

問題 No.501 穴と文字列
ユーザー vjudge1
提出日時 2025-06-24 17:55:49
言語 C++17(clang)
(17.0.6 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 557 bytes
コンパイル時間 5,273 ms
コンパイル使用メモリ 171,088 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-06-24 17:55:56
合計ジャッジ時間 3,517 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

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