結果
問題 |
No.706 多眼生物の調査
|
ユーザー |
![]() |
提出日時 | 2018-07-10 23:11:43 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 478 bytes |
コンパイル時間 | 415 ms |
コンパイル使用メモリ | 22,912 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-14 00:19:01 |
合計ジャッジ時間 | 746 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 5 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:9:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | scanf("%d", &N); | ~~~~~^~~~~~~~~~ main.cpp:12:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 12 | scanf("%s", S); | ~~~~~^~~~~~~~~
ソースコード
#include <stdio.h> int main(){ int N; int a[1001] = {0}; int i, j, c; char S[1000]; scanf("%d", &N); for(i = 0; i < N; i++){ scanf("%s", S); for(j = 0, c = 0; S[j] != '\0'; j++){ if(S[j] == '^') c++; } a[c]++; } j = a[0]; c = 0; for(i = 1; i < 1001; i++){ if(j <= a[i]){ j = a[i]; c = i; } } printf("%d\n", c); return 0; }