結果
問題 |
No.405 ローマ数字の腕時計
|
ユーザー |
|
提出日時 | 2017-03-22 16:50:11 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 567 bytes |
コンパイル時間 | 211 ms |
コンパイル使用メモリ | 21,248 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-06 19:09:58 |
合計ジャッジ時間 | 948 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:12:17: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘char (*)[5]’ [-Wformat=] 12 | scanf("%s %d", &si,&t); | ~^ ~~~ | | | | char * char (*)[5] main.c:12:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 12 | scanf("%s %d", &si,&t); | ^~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> #include<string.h> int main(void) { int i,t,ans=0; char si[5],moji[12][5]={"I","II","III","IIII", "V","VI","VII","VIII", "IX","X","XI","XII"}; scanf("%s %d", &si,&t); for (i = 0; i < 12; i++) { if(0 == strcmp(si,moji[i])) break; } // printf("%s %d\n",si,t); // printf("%d\n",i+1); if((i+1+t%12)>=0){ ans=(i+1+t%12)%12; // printf("%d\n",(i+1+t%12)%12); }else{ // printf("%d\n",(i+1+t%12)%12+12); ans=(i+1+t%12)%12+12; } if(ans!=0) printf("%s",moji[ans-1]); else printf("XII"); return 0; }