結果
問題 | No.349 干支の置き物 |
ユーザー | butsurizuki |
提出日時 | 2016-11-30 16:13:40 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 442 bytes |
コンパイル時間 | 261 ms |
コンパイル使用メモリ | 20,736 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-27 14:00:01 |
合計ジャッジ時間 | 1,089 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:7:9: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration] 7 | scanf("%d",&n); | ^~~~~ main.c:2:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’ 1 | #include <string.h> +++ |+#include <stdio.h> 2 | main.c:7:9: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch] 7 | scanf("%d",&n); | ^~~~~ main.c:7:9: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’ main.c:18:30: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration] 18 | if(c[i] > n){printf("NO\n");return 0;} | ^~~~~~ main.c:18:30: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’ main.c:18:30: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch] main.c:18:30: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’ main.c:20:9: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch] 20 | printf("YES\n"); | ^~~~~~ main.c:20:9: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
ソースコード
#include <string.h> int main(void) { char *s[16] = {"ne","ushi","tora","u","tatsu","mi","uma","hitsuji","saru","tori","inu","i"}; char t[16]; int c[16] = {0},n,i,j,k; scanf("%d",&n); for(i = 1;i <= n;i++){ scanf("%s",t); for(j = 0;j <= 11;j++){ k = strcmp(t,s[j]); if(!k){c[j]++;} } } if(n%2){n = (n/2)+1;} else{n = n/2;} for(i = 0;i <= 11;i++){ if(c[i] > n){printf("NO\n");return 0;} } printf("YES\n"); return 0; }