結果
| 問題 |
No.405 ローマ数字の腕時計
|
| コンテスト | |
| ユーザー |
iroha168
|
| 提出日時 | 2017-01-14 00:22:09 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 810 bytes |
| コンパイル時間 | 849 ms |
| コンパイル使用メモリ | 93,648 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-24 04:17:48 |
| 合計ジャッジ時間 | 1,786 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 24 WA * 3 |
ソースコード
#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 ? 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;
}
iroha168