結果
問題 | No.501 穴と文字列 |
ユーザー |
|
提出日時 | 2017-04-21 20:27:57 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 426 bytes |
コンパイル時間 | 705 ms |
コンパイル使用メモリ | 58,488 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-14 16:35:20 |
合計ジャッジ時間 | 1,203 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 22 |
ソースコード
#include <iostream>#include <string>#include <vector>using namespace std;int main() {int N, D;cin >> N >> D;int d = D - 1;vector<char> s(N);for (int i = N - 1; i >= 0; i--) {if (d > i) {s[i] = 'B';d -= 2;} else if (d == i) {s[i] = 'A';d--;} else {s[i] = 'C';}}for (int i = 0; i < N; i++) {cout << s[i];}cout << endl;return 0;}