結果
問題 |
No.405 ローマ数字の腕時計
|
ユーザー |
![]() |
提出日時 | 2016-08-05 22:49:28 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,347 bytes |
コンパイル時間 | 454 ms |
コンパイル使用メモリ | 57,612 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-12-24 04:06:16 |
合計ジャッジ時間 | 1,349 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 8 WA * 19 |
ソースコード
#include <iostream> using namespace std; int solve(char *str, int t); int main(void) { int t,n=0; char s[5]; cin >> s >> t; n = solve(s, t); if(n == 0) { cout << "XII"<< endl; } else if(n == 1) { cout << "I"<<endl; } else if(n == 2) { cout << "II"<<endl; } else if(n == 3) { cout << "III"<<endl; } else if(n == 4) { cout << "IIII"<<endl; } else if(n == 5) { cout<< "V"<<endl; } else if(n == 6) { cout<< "VI"<<endl; } else if(n == 7) { cout<< "VII"<<endl; } else if(n == 8) { cout<< "VIII"<<endl; } else if(n == 9) { cout<< "IX"<<endl; } else if(n == 10) { cout<< "X"<<endl; }else if(n == 11) { cout << "XI"<< endl; } return 0; } int solve(char *str, int t) { int n = 0; if (str[0] == 'I'&&str[1]=='\0') { n = 1+t; }else if(str == "II") { n = 2+t; }else if(str == "III") { n = 3+t; }else if (str == "IIII") { n = 4+t; }else if(str[0] == 'V'&&str[1]=='\0') { n = 5+t; }else if(str == "VI") { n = 6+t; }else if(str == "VII") { n = 7+t; }else if(str == "VIII") { n = 8+t; }else if(str == "IX") { n = 9+t; }else if(str[0] == 'X'&& str[1] =='\0') { n = 10+t; }else if(str == "XI") { n = 11+t; }else if(str == "XII") { n = 12+t; cout << "1" << endl; } n %= 12; return n; }