結果

問題 No.405 ローマ数字の腕時計
ユーザー alchemin
提出日時 2019-09-16 21:29:48
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,392 bytes
コンパイル時間 459 ms
コンパイル使用メモリ 66,364 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-06 19:24:18
合計ジャッジ時間 1,204 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

using namespace std;

int main() {
    string s;
    int t;
    
    cin >> s >> t;
    
    int tm = 1200;
    if (s == "I") {
        tm += 1;
    } else if (s == "II") {
        tm += 2;
    } else if (s == "III") {
        tm += 3;
    } else if (s == "IIII") {
        tm += 4;
    } else if (s == "V") {
        tm += 5;
    } else if (s == "VI") {
        tm += 6;
    } else if (s == "VII") {
        tm += 7;
    } else if (s == "VIII") {
        tm += 8;
    } else if (s == "IX") {
        tm += 9;
    } else if (s == "X") {
        tm += 10;
    } else if (s == "XI") {
        tm += 11;
    } else if (s == "XII") {
        tm += 12;
    }
    
    tm = (t + tm) % 12;
    
    if (tm == 0) {
        cout << "XII" << endl;
    } else if (tm == 1) {
        cout << "I" << endl;
    } else if (tm == 2) {
        cout << "II" << endl;
    } else if (tm == 3) {
        cout << "III" << endl;
    } else if (tm == 4) {
        cout << "IIII" << endl;
    } else if (tm == 5) {
        cout << "V" << endl;
    } else if (tm == 6) {
        cout << "VI" << endl;
    } else if (tm == 7) {
        cout << "VII" << endl;
    } else if (tm == 8) {
        cout << "VIII" << endl;
    } else if (tm == 9) {
        cout << "IX" << endl;
    } else if (tm == 10) {
        cout << "X" << endl;
    } else {
        cout << "XI" << endl;
    }
    
    return 0;
}
0