結果

問題 No.405 ローマ数字の腕時計
ユーザー notetonousnotetonous
提出日時 2016-08-05 22:36:10
言語 C90
(gcc 11.4.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 914 bytes
コンパイル時間 494 ms
コンパイル使用メモリ 21,376 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-06 18:58:59
合計ジャッジ時間 1,100 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
6,812 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 1 ms
6,944 KB
testcase_06 AC 1 ms
6,940 KB
testcase_07 WA -
testcase_08 AC 1 ms
6,944 KB
testcase_09 AC 1 ms
6,948 KB
testcase_10 AC 0 ms
6,940 KB
testcase_11 WA -
testcase_12 AC 1 ms
6,940 KB
testcase_13 AC 0 ms
6,940 KB
testcase_14 AC 0 ms
6,940 KB
testcase_15 AC 0 ms
6,940 KB
testcase_16 AC 0 ms
6,940 KB
testcase_17 AC 1 ms
6,940 KB
testcase_18 AC 0 ms
6,944 KB
testcase_19 AC 0 ms
6,940 KB
testcase_20 AC 0 ms
6,940 KB
testcase_21 AC 0 ms
6,944 KB
testcase_22 AC 1 ms
6,940 KB
testcase_23 AC 0 ms
6,944 KB
testcase_24 AC 1 ms
6,940 KB
testcase_25 AC 0 ms
6,944 KB
testcase_26 AC 1 ms
6,944 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:5:3: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration]
    5 |   scanf("%s",s);
      |   ^~~~~
main.c:2:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
    1 | #include <string.h>
  +++ |+#include <stdio.h>
    2 | int main(){
main.c:5:3: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch]
    5 |   scanf("%s",s);
      |   ^~~~~
main.c:5:3: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
main.c:23:11: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration]
   23 |   if(t==1)printf("I\n");
      |           ^~~~~~
main.c:23:11: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
main.c:23:11: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch]
main.c:23:11: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
main.c:24:16: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch]
   24 |   else if(t==2)printf("II\n");
      |                ^~~~~~
main.c:24:16: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
main.c:25:16: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch]
   25 |   else if(t==3)printf("III\n");
      |                ^~~~~~
main.c:25:16: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
main.c:26:18: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch]
   26 |   else if(t==4)  printf("IIII\n");
      |                  ^~~~~~
main.c:26:18: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
main.c:27:16: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch]
   27 

ソースコード

diff #

#include <string.h>
int main(){
  char s[4];
  int t,x;
  scanf("%s",s);
  scanf("%d",&t);
  if(strcmp(s,"I")==0)x=1;
  else if(strcmp(s,"II")==0)x=2;
  else if(strcmp(s,"III")==0)x=3;
  else if(strcmp(s,"IIII")==0)x=4;
  else if(strcmp(s,"V")==0)x=5;
  else if(strcmp(s,"VI")==0)x=6;
  else if(strcmp(s,"VII")==0)x=7;
  else if(strcmp(s,"VIII")==0)x=8;
  else if(strcmp(s,"IX")==0)x=9;
  else if(strcmp(s,"X")==0)x=10;
  else if(strcmp(s,"XI")==0)x=11;
  else if(strcmp(s,"XII")==0)x=0;
  if(t<0){
    while(t<=0)t+=12;
  }
  t=(t+x)%12;
  if(t==1)printf("I\n");
  else if(t==2)printf("II\n");
  else if(t==3)printf("III\n");
  else if(t==4)  printf("IIII\n");
  else if(t==5)printf("V\n");
  else if(t==6)printf("VI\n");
  else if(t==7)printf("VII\n");
  else if(t==8)printf("VIII\n");
  else if(t==9)printf("IX\n");
  else if(t==10)printf("X\n");
  else if(t==11)printf("XI\n");
  else printf("XII\n");
	    
}
0