結果

問題 No.405 ローマ数字の腕時計
ユーザー focus
提出日時 2018-01-17 17:48:39
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 483 bytes
コンパイル時間 443 ms
コンパイル使用メモリ 62,288 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-06 19:15:37
合計ジャッジ時間 1,181 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 27
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:14:8: warning: ‘a’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   14 |     num+=a;
      |     ~~~^~~

ソースコード

diff #

#include<iostream>
#include<vector>
#include<string>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
    int num,a;
    string str,table[12]={"I\0","II\0","III\0","IIII\0","V\0","VI\0","VII\0","VIII\0","IX\0","X\0","XI\0","XII\0"};
    cin >> str >> num;
    for(int i=0;i<=11;i++){
        if(str==table[i])   a = i;
    }
    num+=a;
    num=num%12;
    if(num<0)   num = 12 + num;
    //cout << a << "  " << num<<endl;
    cout << table[num];
    return 0;
}
0