結果
| 問題 | No.501 穴と文字列 |
| コンテスト | |
| ユーザー |
けーむ
|
| 提出日時 | 2020-08-04 11:54:50 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,046 bytes |
| コンパイル時間 | 1,596 ms |
| コンパイル使用メモリ | 169,016 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-14 11:42:54 |
| 合計ジャッジ時間 | 2,665 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 22 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
// ifstream in("input.txt");
// cin.rdbuf(in.rdbuf());
ll n, d;
cin >> n >> d;
vector<ll> cnt(3, 0);
rep(c, 2 * n + 1) {
ll a = n - d + c;
ll b = d - 2 * c;
if ((a >= 0) && (b >= 0) && (c >= 0)) {
cnt[0] = a;
cnt[1] = b;
cnt[2] = c;
break;
}
}
string ans = "";
rep(i, cnt[1]) ans += 'A';
rep(i, cnt[2]) ans += 'B';
rep(i, cnt[0]) ans += 'C';
cout << ans << endl;
return 0;
}
けーむ