結果

問題 No.706 多眼生物の調査
コンテスト
ユーザー N/A
提出日時 2018-07-04 21:23:18
言語 C90(gcc12)
(gcc 12.4.0)
コンパイル:
gcc-12 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 437 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 101 ms
コンパイル使用メモリ 29,512 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2026-03-08 16:17:41
合計ジャッジ時間 621 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 5
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:12:25: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘int (*)[1000]’ [-Wformat=]
   12 |                 scanf("%s", &creature);
      |                        ~^   ~~~~~~~~~
      |                         |   |
      |                         |   int (*)[1000]
      |                         char *
main.c:13:29: warning: passing argument 1 of ‘strlen’ from incompatible pointer type [-Wincompatible-pointer-types]
   13 |                 eyes[strlen(creature) - 2]++;
      |                             ^~~~~~~~
      |                             |
      |                             int *
In file included from main.c:3:
/usr/include/string.h:407:35: note: expected ‘const char *’ but argument is of type ‘int *’
  407 | extern size_t strlen (const char *__s)
      |                       ~~~~~~~~~~~~^~~
main.c:9:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |         scanf("%d", &freq);
      |         ^~~~~~~~~~~~~~~~~~
main.c:12:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |                 scanf("%s", &creature);
      |                 ^~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #
raw source code

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>

int main(void) {
	int freq, creature[1000], eyes[1001] = { 0 };
	int i, j, blind = 0, mode;

	scanf("%d", &freq);

	for (i = 0; i < freq; i++) {
		scanf("%s", &creature);
		eyes[strlen(creature) - 2]++;
	}

	for (j = 0; j < 1001; j++) {
		if (blind <= eyes[j]) {
			blind = eyes[j];
			mode = j;
		}
	}

	printf("%d\n", mode);

	return 0;
}
0