結果

問題 No.405 ローマ数字の腕時計
ユーザー Mister
提出日時 2020-04-07 08:20:44
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 585 bytes
コンパイル時間 2,833 ms
コンパイル使用メモリ 76,884 KB
最終ジャッジ日時 2025-01-09 14:49:22
ジャッジサーバーID
(参考情報)
judge1 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

const std::vector<std::string>
    nums = {"I", "II", "III", "IIII", "V",
            "VI", "VII", "VIII", "IX", "X",
            "XI", "XII"};

void solve() {
    std::string s;
    std::cin >> s;

    int t;
    for (t = 0; t < 12; ++t) {
        if (nums[t] == s) break;
    }

    int d;
    std::cin >> d;
    (t += d) %= 12;
    if (t < 0) t += 12;

    std::cout << nums[t] << std::endl;
}

int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);

    solve();

    return 0;
}
0