結果
| 問題 |
No.405 ローマ数字の腕時計
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-10-14 00:12:00 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 692 bytes |
| コンパイル時間 | 456 ms |
| コンパイル使用メモリ | 59,032 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-06 19:13:56 |
| 合計ジャッジ時間 | 1,169 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 27 |
ソースコード
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
string S;
int T;
cin >> S >> T;
int now_time = 0;
if(S == "IX"){
now_time = 9;
}else{
for(int i = 0; i < S.size(); i++){
if(S[i] == 'X'){
now_time += 10;
}else if(S[i] == 'V'){
now_time += 5;
}else{
now_time++;
}
}
}
now_time = (now_time + T + 1199) % 12 + 1;
if(now_time == 9){
cout << "IX" << endl;
}else{
for(int i = 0; i < now_time / 10; i++){
cout << "X";
}
now_time -= now_time / 10 * 10;
for(int i = 0; i < now_time / 5; i++){
cout << "V";
}
now_time -= now_time / 5 * 5;
for(int i = 0; i < now_time; i++){
cout << "I";
}
cout << endl;
}
}