結果
問題 | No.405 ローマ数字の腕時計 |
ユーザー |
|
提出日時 | 2017-03-22 16:37:29 |
言語 | C90 (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 527 bytes |
コンパイル時間 | 151 ms |
コンパイル使用メモリ | 21,504 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-05 17:40:03 |
合計ジャッジ時間 | 1,070 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 WA * 3 |
コンパイルメッセージ
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;printf("%s\n",moji[ans-1]);return 0;}