結果

問題 No.501 穴と文字列
ユーザー delt
提出日時 2019-03-03 19:33:52
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 457 bytes
コンパイル時間 602 ms
コンパイル使用メモリ 60,768 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-23 13:17:50
合計ジャッジ時間 1,454 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;

int main(void){
  int n, d;
  cin >> n >> d;
  int needb = d - n;
  string ans = "";
  if(needb <= 0){
    for(int i = 0; i < n; i++){
      if(d == 0) ans += "C";
      else {
	ans += "A";
	d--;
      }
    }
  }else{
    for(int i = 0; i < n - needb; i++) ans += "A";
    for(int i = 0; i < needb; i++) ans += "B";
  }
  cout << ans << endl;
  return 0;
}
0