結果

問題 No.405 ローマ数字の腕時計
ユーザー ふーらくたる
提出日時 2016-08-05 22:26:51
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 612 bytes
コンパイル時間 612 ms
コンパイル使用メモリ 72,940 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-06 18:57:41
合計ジャッジ時間 1,366 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <map>
using namespace std;

int main() {
    map<string, int> roman;
    roman["I"] = 0; roman["II"] = 1; roman["III"] = 2;
    roman["IIII"] = 3; roman["V"] = 4; roman["VI"] = 5;
    roman["VII"] = 6; roman["VIII"] = 7; roman["IX"] = 8;
    roman["X"] = 9; roman["XI"] = 10; roman["XII"] = 11;

    string s1;
    int T, next_T;
    cin >> s1 >> T;
    next_T = (roman[s1] + 12 * 100 + T) % 12;
    for (auto it = roman.begin(); it != roman.end(); it++) {
        if (it->second == next_T) {
            cout << it->first << endl;
            break;
        }
    }
    return 0;
}
0