結果
問題 |
No.405 ローマ数字の腕時計
|
ユーザー |
![]() |
提出日時 | 2019-06-27 18:04:09 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 398 bytes |
コンパイル時間 | 502 ms |
コンパイル使用メモリ | 62,756 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-06 19:22:47 |
合計ジャッジ時間 | 1,282 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:19:8: warning: ‘x’ may be used uninitialized in this function [-Wmaybe-uninitialized] 19 | if (x+t>=0) { | ~^~
ソースコード
#include <iostream> #include <string> #include <vector> using namespace std; int main() { vector<string> v{"I","II","III","IIII","V","VI","VII","VIII","IX","X","XI","XII"}; string s; int t, x; cin >> s >> t; for (int i=0; i<12; i++) { if (v[i]==s) { x=i; } } if (x+t>=0) { cout << v[((x+t)%12)] << endl; } else { cout << v[(1200+(x+t))%12] << endl; } }