結果

問題 No.405 ローマ数字の腕時計
ユーザー Syuutaro
提出日時 2018-03-18 23:38:11
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 921 bytes
コンパイル時間 579 ms
コンパイル使用メモリ 64,372 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-06 19:16:51
合計ジャッジ時間 1,349 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 27
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |     scanf("%s %d",S1,&T);
      |     ~~~~~^~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <map>
#include <string>
int main(){
    //input
    char S1[5];
    int T;
    scanf("%s %d",S1,&T);
    std::string s1(S1);

    std::map<int,std::string> table1;
    table1[0] = "I";
    table1[1] = "II";
    table1[2] = "III";
    table1[3] = "IIII";
    table1[4] = "V";
    table1[5] = "VI";
    table1[6] = "VII";
    table1[7] = "VIII";
    table1[8] = "IX";
    table1[9] = "X";
    table1[10] = "XI";
    table1[11] = "XII";

    std::map<std::string,int> table2;
    table2[table1[0]] = 0;
    table2[table1[1]] = 1;
    table2[table1[2]] = 2;
    table2[table1[3]] = 3;
    table2[table1[4]] = 4;
    table2[table1[5]] = 5;
    table2[table1[6]] = 6;
    table2[table1[7]] = 7;
    table2[table1[8]] = 8;
    table2[table1[9]] = 9;
    table2[table1[10]] = 10;
    table2[table1[11]] = 11;

    //output
    printf("%s\n",table1[(table2[s1]+T+12*1000)%12].c_str());
    return 0;
}
0