結果
問題 | No.501 穴と文字列 |
ユーザー |
|
提出日時 | 2017-04-21 20:27:52 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 475 bytes |
コンパイル時間 | 480 ms |
コンパイル使用メモリ | 59,024 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-14 16:35:19 |
合計ジャッジ時間 | 1,155 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 22 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:26:18: warning: ‘b’ may be used uninitialized in this function [-Wmaybe-uninitialized] 26 | for(int ib=0;ib<b;ib++){ | ~~^~
ソースコード
#include<iostream> #include<string> #include<vector> //A = 65 using namespace std; int main(){ double a,b,c; int n, d; cin >> n >> d; double lack = d - n; string res = ""; if(lack > 0){ b = lack; c = 0; }else if(lack < 0){ c = -1*lack; b = 0; } a = n - b - c; for(int ia=0;ia<a;ia++){ res += "A"; } for(int ib=0;ib<b;ib++){ res += "B"; } for(int ic=0;ic<c;ic++){ res += "C"; } cout << res << endl; return 0; }