結果
問題 |
No.405 ローマ数字の腕時計
|
ユーザー |
![]() |
提出日時 | 2016-08-10 22:01:35 |
言語 | C90 (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 375 bytes |
コンパイル時間 | 235 ms |
コンパイル使用メモリ | 22,400 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-12-24 04:07:43 |
合計ジャッジ時間 | 1,224 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 WA * 6 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:10:29: warning: implicit declaration of function ‘abs’ [-Wimplicit-function-declaration] 10 | if (t < 0) t = 12 - abs(t) % 12; | ^~~ main.c:4:1: note: include ‘<stdlib.h>’ or provide a declaration of ‘abs’ 3 | #include <math.h> +++ |+#include <stdlib.h> 4 | main.c:9:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | scanf("%s %d", s, &t); | ^~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> #include <string.h> #include <math.h> int main() { char s[5], rome[12][5] = { "I","II","III","IIII","V","VI","VII","VIII","IX","X","XI","XII" }; int t, i; scanf("%s %d", s, &t); if (t < 0) t = 12 - abs(t) % 12; for (i = 0; i < 12; i++) { if (strcmp(s, rome[i]) == 0) { printf("%s\n", rome[(i + t + 1) % 12 - 1]); break; } } return 0; }