結果
問題 | No.405 ローマ数字の腕時計 |
ユーザー |
![]() |
提出日時 | 2017-09-26 18:28:45 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 675 bytes |
コンパイル時間 | 575 ms |
コンパイル使用メモリ | 81,304 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-06 19:13:29 |
合計ジャッジ時間 | 1,351 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:32:7: warning: ‘n’ may be used uninitialized in this function [-Wmaybe-uninitialized] 32 | n += T; | ~~^~~~
ソースコード
#include <iostream> #include <vector> #include <string> #include <cstring> #include <math.h> #include <cmath> #include <limits.h> #include <map> #include <set> #include <queue> #include <algorithm> #include <functional> #include <stdio.h> using namespace std; long long MOD = 1000000007; int main() { string N[12] = { "I","II","III","IIII","V","VI","VII","VIII","IX","X","XI","XII" }; string S; cin >> S; int T; cin >> T; int n; for ( int i = 0; i < 12; i++ ) { if ( S == N[i] ) { n = i; break; } } n += T; n = n >= 0 ? n%12 : (12-(abs(n)%12))%12; cout << N[n] << endl; return 0; }