結果
問題 | No.405 ローマ数字の腕時計 |
ユーザー |
![]() |
提出日時 | 2017-01-14 00:24:18 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 814 bytes |
コンパイル時間 | 950 ms |
コンパイル使用メモリ | 95,260 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-24 04:17:57 |
合計ジャッジ時間 | 2,005 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 WA * 4 |
ソースコード
#include<string> #include<iostream> #include<algorithm> #include<set> #include<math.h> #include<vector> #include<sstream> #include<queue> #include<functional> #include<bitset> #include<cstdio> #include<iomanip> using namespace std; int x[100000]; int main() { string s, t=""; int n,c=0; cin >> s >> n; if (s == "IX") { c = 9; } else { for (int i = 0; i < s.length(); i++) { if (s[i] == 'I') c++; else if (s[i] == 'V')c += 5; else c += 10; } } if (n >= 0) { c = c + n % 12 == 0 ? 12 :(c + n) % 12; } else { n = n % 24; c = (c + n <= 0) ? 12 + (c + n) : c + n; } if (c == 9) { cout << "IX"; } else { if (c >= 10) { cout << "X"; c -= 10; } else if( c >= 5 ) { cout << "V"; c -= 5; } while (c) { cout << "I"; c--; } } cout << endl; return 0; }