結果
問題 |
No.405 ローマ数字の腕時計
|
ユーザー |
![]() |
提出日時 | 2018-09-27 22:46:02 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 788 bytes |
コンパイル時間 | 768 ms |
コンパイル使用メモリ | 77,380 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-12 04:37:28 |
合計ジャッジ時間 | 1,455 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 WA * 2 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:36:14: warning: ‘memo’ may be used uninitialized in this function [-Wmaybe-uninitialized] 36 | memo += a; | ~~~~~^~~~
ソースコード
//inlclude前用define #define _USE_MATH_DEFINES //include #include<iostream> #include<string> #include<algorithm> #include<vector> #include<cmath> #include<cstdio> #include<type_traits> #include<numeric> #include<limits> #include<iomanip> using namespace std; //typedef typedef vector<int> VI; typedef vector<string> VS; typedef vector<char> VC; //grobal変数 int main() { VS hour = {"I","II","III","IIII","V","VI","VII","VIII","IX","X","XI","XII" }; string s; int a; cin >> s >> a; int memo; for (int i = 0; i < 12; i++) { if (s == hour[i]) { memo = i; } } memo += a; if (memo >= 12) { while (memo > 12) { memo -= 12; } } else if (memo < 0) { while (memo < 0) { memo += 12; } } //cout << memo << endl; cout << hour[memo] << endl; return 0; }