結果
問題 | No.349 干支の置き物 |
ユーザー | くれちー |
提出日時 | 2016-09-29 23:59:52 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 471 bytes |
コンパイル時間 | 160 ms |
コンパイル使用メモリ | 21,632 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-21 10:42:47 |
合計ジャッジ時間 | 1,102 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:8:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 8 | scanf("%d", &n); | ^~~~~~~~~~~~~~~ main.c:10:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | scanf("%s", s); | ^~~~~~~~~~~~~~
ソースコード
#include <stdio.h> #include <string.h> int main() { char s[8], eto[12][8] = { "ne","ushi","tora","u","tatsu","mi","uma","hitsuji","saru","tori","inu","i" }; int n, cnt[12] = {}, max = 0, i, j; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%s", s); for (j = 0; j < 12; j++) { if (strcmp(s, eto[j]) == 0) cnt[j]++; if (cnt[j] > max) max = cnt[j]; } } if (max <= (n % 2 == 0 ? n / 2 : n / 2 + 1)) printf("YES\n"); else printf("NO\n"); return 0; }