結果

問題 No.405 ローマ数字の腕時計
ユーザー notetonous
提出日時 2016-08-05 22:37:21
言語 C90
(gcc 12.3.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 933 bytes
コンパイル時間 114 ms
コンパイル使用メモリ 22,144 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-06 18:59:01
合計ジャッジ時間 942 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25 WA * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:6:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |   scanf("%s",s);
      |   ^~~~~~~~~~~~~
main.c:7:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |   scanf("%d",&t);
      |   ^~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#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