結果
問題 | No.501 穴と文字列 |
ユーザー |
|
提出日時 | 2017-04-11 11:36:01 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 531 bytes |
コンパイル時間 | 760 ms |
コンパイル使用メモリ | 74,184 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-14 16:31:42 |
合計ジャッジ時間 | 1,444 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 22 |
ソースコード
#include<iostream> #include<vector> #include<algorithm> #include<cmath> #include<string> using namespace std; int main(){ int n, d; cin >> n >> d; string res = ""; string res_back = ""; for(int i=0; i<d; i++) res.push_back('A'); n -= res.length(); while(n != 0){ if(n == 1) { res_back.push_back('C'); break; } if(n < 0){ res.pop_back(); res.pop_back(); res_back.push_back('B'); n += 1; }else{ res_back.push_back('C'); n -= 1; } } cout << res << res_back<< endl; }