結果

問題 No.405 ローマ数字の腕時計
ユーザー okayunonahaokayunonaha
提出日時 2016-08-05 22:49:28
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,347 bytes
コンパイル時間 476 ms
コンパイル使用メモリ 52,548 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-08-25 18:16:52
合計ジャッジ時間 1,603 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 2 ms
4,384 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 1 ms
4,380 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 1 ms
4,380 KB
testcase_18 WA -
testcase_19 AC 1 ms
4,384 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 2 ms
4,384 KB
testcase_26 AC 1 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

int solve(char *str, int t);

int main(void) {
  int t,n=0;
  char s[5];
  cin >> s >> t;

  n = solve(s, t);

  if(n == 0) {
    cout <<  "XII"<< endl;
  } else if(n == 1) {
    cout << "I"<<endl;
  } else if(n == 2) {
    cout << "II"<<endl;
  } else if(n == 3) {
    cout << "III"<<endl;
  } else if(n == 4) {
    cout <<  "IIII"<<endl;
  } else if(n == 5) {
    cout<< "V"<<endl;
  } else if(n == 6) {
    cout<< "VI"<<endl;
  } else if(n == 7) {
    cout<< "VII"<<endl;
  } else if(n == 8) {
    cout<< "VIII"<<endl;
  } else if(n == 9) {
    cout<< "IX"<<endl;
  } else if(n == 10) {
    cout<< "X"<<endl;
  }else if(n == 11) {
    cout << "XI"<< endl;
  }

  return 0;
}

int solve(char *str, int t) {
  int n = 0;
  if (str[0] == 'I'&&str[1]=='\0') {
    n = 1+t;
  }else if(str == "II") {
    n = 2+t;

  }else if(str == "III") {
    n = 3+t;

  }else if (str == "IIII") {
    n = 4+t;
	
  }else if(str[0] == 'V'&&str[1]=='\0') {
    n = 5+t;

  }else if(str == "VI") {
    n = 6+t;
  }else if(str == "VII") {
    n = 7+t;
  }else if(str == "VIII") {
    n = 8+t;
  }else if(str == "IX") {
    n = 9+t;
  }else if(str[0] == 'X'&& str[1] =='\0') {
    n = 10+t;
  }else if(str == "XI") {
    n = 11+t;
  }else if(str == "XII") {
    n = 12+t;
    cout << "1" << endl;
  }
  n %= 12;
  return n;
}
0