結果
問題 | No.706 多眼生物の調査 |
ユーザー | subsn |
提出日時 | 2023-06-16 09:50:53 |
言語 | C (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 373 bytes |
コンパイル時間 | 133 ms |
コンパイル使用メモリ | 28,672 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-24 04:16:54 |
合計ジャッジ時間 | 640 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
5,248 KB |
testcase_01 | AC | 1 ms
5,376 KB |
testcase_02 | AC | 1 ms
5,376 KB |
testcase_03 | AC | 1 ms
5,376 KB |
testcase_04 | AC | 1 ms
5,376 KB |
testcase_05 | AC | 2 ms
5,376 KB |
testcase_06 | AC | 3 ms
5,376 KB |
testcase_07 | AC | 1 ms
5,376 KB |
コンパイルメッセージ
main.c:1:1: warning: return type defaults to 'int' [-Wimplicit-int] 1 | main(n,max,index,i) | ^~~~ main.c: In function 'main': main.c:1:1: warning: type of 'n' defaults to 'int' [-Wimplicit-int] main.c:1:1: warning: type of 'max' defaults to 'int' [-Wimplicit-int] main.c:1:1: warning: type of 'index' defaults to 'int' [-Wimplicit-int] main.c:1:1: warning: type of 'i' defaults to 'int' [-Wimplicit-int] main.c:4:5: warning: implicit declaration of function 'memset' [-Wimplicit-function-declaration] 4 | memset(c,0,sizeof(int)*1001); | ^~~~~~ main.c:1:1: note: include '<string.h>' or provide a declaration of 'memset' +++ |+#include <string.h> 1 | main(n,max,index,i) main.c:4:5: warning: incompatible implicit declaration of built-in function 'memset' [-Wbuiltin-declaration-mismatch] 4 | memset(c,0,sizeof(int)*1001); | ^~~~~~ main.c:4:5: note: include '<string.h>' or provide a declaration of 'memset' main.c:7:5: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 7 | scanf("%d",&n); | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | main(n,max,index,i) main.c:7:5: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 7 | scanf("%d",&n); | ^~~~~ main.c:7:5: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:11:11: warning: implicit declaration of function 'strlen' [-Wimplicit-function-declaration] 11 | c[strlen(s)-2]++; | ^~~~~~ main.c:11:11: note: include '<string.h>' or provide a declaration of 'strlen' main.c:11:11: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch] main.c:11:11: note: include '<string.h>' or provide a declaration of 'strlen' main.c:19:5: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
ソースコード
main(n,max,index,i) { int c[1001]; memset(c,0,sizeof(int)*1001); max = 0; index = 0; scanf("%d",&n); char s[1024]; for (i = 0;i < n;i++) { scanf("%s", &s); c[strlen(s)-2]++; } for (i = 0;i < 1000;i++) { if (c[i] >= max) { index = i; max = c[i]; } } printf("%d\n",index); }