結果
問題 |
No.405 ローマ数字の腕時計
|
ユーザー |
![]() |
提出日時 | 2017-08-26 11:20:21 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 359 bytes |
コンパイル時間 | 537 ms |
コンパイル使用メモリ | 58,068 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-06 19:12:55 |
合計ジャッジ時間 | 1,141 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:18:15: warning: ‘a’ may be used uninitialized in this function [-Wmaybe-uninitialized] 18 | cout << t[a % 12] << endl; | ~~^~~~
ソースコード
#include <iostream> #include <string> using namespace std; string t[] = { "XII", "I","II","III","IIII","V","VI","VII","VIII","IX","X","XI" }; int main() { string s; int n, a; cin >> s >> n; for (int i = 0; i < 12 ; i++) { if (s == t[i]) { a = i + (n % 24); if (a < 0) a = 24 + a; break; } } cout << t[a % 12] << endl; }