結果
問題 |
No.501 穴と文字列
|
ユーザー |
![]() |
提出日時 | 2018-03-16 21:04:12 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 657 bytes |
コンパイル時間 | 705 ms |
コンパイル使用メモリ | 64,896 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-21 14:39:06 |
合計ジャッジ時間 | 1,229 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 22 |
ソースコード
// No.501 穴と文字列 // https://yukicoder.me/problems/no/501 // #include <iostream> #include <string> using namespace std; string solve(int N, int D); int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); int N, D; cin >> N >> D; string ans = solve(N, D); cout << ans << endl; } string solve(int N, int D) { int excess = D - N; if (excess >= 0) { string a(N - excess, 'A'); string b(excess, 'B'); string ans = a + b; return ans; } else { string a(N + excess, 'A'); string c(-excess, 'C'); string ans = a + c; return ans; } }