結果

問題 No.405 ローマ数字の腕時計
ユーザー tokizotokizo
提出日時 2018-01-14 15:34:04
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 802 bytes
コンパイル時間 647 ms
コンパイル使用メモリ 77,652 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-25 17:21:44
合計ジャッジ時間 1,770 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 WA -
testcase_02 AC 1 ms
4,380 KB
testcase_03 WA -
testcase_04 AC 1 ms
4,376 KB
testcase_05 WA -
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 1 ms
4,380 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 1 ms
4,380 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:35:10: 警告: ‘t1’ may be used uninitialized [-Wmaybe-uninitialized]
   35 |     if(t + t1 < 0){
      |        ~~^~~~
main.cpp:26:9: 備考: ‘t1’ はここで定義されています
   26 |     int t1;
      |         ^~

ソースコード

diff #

#include <iostream>
#include <math.h>
#include <algorithm>
#include <functional>
#include <vector>
#include <typeinfo>
#include <climits>
#include <ctype.h>
#include <string>
#include <stdio.h>
using namespace std;
#define INIT cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i, a, n) for (int i = a; i < n; i++)
#define REP(i, n) for(int i = 0; i < n; i++)

int main()
{
    INIT;

    string s;
    int t;
    cin >> s >> t;

    string R[12] = {"XII", "I", "II", "III", "IIII", "V", "VII", "VIII", "IX", "X", "XI", "XII"};
    
    int t1;
    REP(i, 12){
        if(s == R[i]){
            t1 = i;
            break;
        }
    }

    int t2;
    if(t + t1 < 0){
        t2 = 12 - (abs(t + t1) % 12);
    }else{
        t2 = (t + t1) % 12;
    }
    cout << R[t2] << endl;


    return 0;
}
0