結果
問題 | No.405 ローマ数字の腕時計 |
ユーザー |
![]() |
提出日時 | 2020-03-20 19:16:12 |
言語 | C (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 923 bytes |
コンパイル時間 | 303 ms |
コンパイル使用メモリ | 30,976 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-12-14 14:53:29 |
合計ジャッジ時間 | 1,493 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 WA * 4 |
ソースコード
#include<stdio.h> #include<string.h> #include<stdlib.h> #include<math.h> int main(void){ char s[10]; int t; int now=0; scanf("%s",s); scanf("%d",&t); for(int i=0;s[i]!='\0';i++){ if(s[0]=='I'&&s[1]=='X'){now=9;break;} else{ if(s[i]=='I'){now++;} else if(s[i]=='V'){now=now+5;} else{now=now+10;} } } now=now+t; for(;;){ if(now<0){now=now+24;} else if(now>24){now=now-24;} else{break;} } if(now==0||now==24){printf("XII\n");} else if(now==1||now==13){printf("I\n");} else if(now==2||now==14){printf("II\n");} else if(now==3||now==15){printf("III\n");} else if(now==4||now==16){printf("IIII\n");} else if(now==5||now==17){printf("V\n");} else if(now==6||now==18){printf("VI\n");} else if(now==7||now==19){printf("VII\n");} else if(now==8||now==20){printf("VIII\n");} else if(now==9||now==21){printf("IX\n");} else if(now==10||now==22){printf("X\n");} else if(now==11||now==23){printf("XI\n");} }