結果

問題 No.405 ローマ数字の腕時計
ユーザー horoyoisawahoroyoisawa
提出日時 2022-01-13 22:12:24
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 431 bytes
コンパイル時間 1,909 ms
コンパイル使用メモリ 171,848 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-28 20:14:32
合計ジャッジ時間 2,839 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 WA -
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 2 ms
5,376 KB
testcase_25 WA -
testcase_26 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:17:9: warning: 'now' may be used uninitialized [-Wmaybe-uninitialized]
   17 |     now += t;
      |     ~~~~^~~~
main.cpp:8:9: note: 'now' was declared here
    8 |     int now;
      |         ^~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    string s1;
    int t;
    cin >> s1 >> t;
    int now;
    vector<string> time_roman = {"I", "II", "III", "IIII", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII"};
    for(int i=0;i<time_roman.size();i++) {
        if(time_roman[i] == s1) {
            now = i;
            break;
        }
    }

    now += t;
    now %= 12;

    cout << time_roman[now] << '\n';
}
0