結果

問題 No.501 穴と文字列
ユーザー k
提出日時 2020-07-15 01:56:08
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 446 bytes
コンパイル時間 4,071 ms
コンパイル使用メモリ 195,176 KB
最終ジャッジ日時 2025-01-11 20:47:45
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for(int i=0; i<(int)(n); i++)

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n, d;
  cin >> n >> d;

  string ret;
  while (n) {
    if (d == 0) {
      ret += 'C';
    }
    else if (d <= n) {
      ret += 'A';
      --d;
    } else {
      ret += 'B';
      d -= 2;
    }
    --n;
  }

  sort(ret.begin(), ret.end());

  cout << ret << endl;
  
  return 0;
}
0