結果
問題 |
No.501 穴と文字列
|
ユーザー |
|
提出日時 | 2020-04-15 21:17:42 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 516 bytes |
コンパイル時間 | 766 ms |
コンパイル使用メモリ | 70,960 KB |
最終ジャッジ日時 | 2025-01-09 19:19:39 |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 22 |
ソースコード
#include <iostream> #include <algorithm> #include <string> void solve() { int n, d; std::cin >> n >> d; std::string ans(n, 'A'); d -= n; for (char& c : ans) { if (d < 0) { c = 'C'; ++d; } if (d > 0) { c = 'B'; --d; } } std::reverse(ans.begin(), ans.end()); std::cout << ans << std::endl; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }