結果
| 問題 |
No.706 多眼生物の調査
|
| コンテスト | |
| ユーザー |
kametaro
|
| 提出日時 | 2018-07-02 18:43:15 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 531 bytes |
| コンパイル時間 | 199 ms |
| コンパイル使用メモリ | 34,404 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-01 01:33:14 |
| 合計ジャッジ時間 | 1,197 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 5 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
6 | scanf("%d",&n);
| ~~~~~^~~~~~~~~
ソースコード
#include <cstdio>
#include <algorithm>
using namespace std;
int main(){
int n;
scanf("%d",&n);
int mob[1001]={};
int eyes[1001]={};
int eyemax=0,ans=0;
char c;
for(int j=0;j<n;j++){
while(c=getchar() !=')' ){
mob[j]++;
}
eyes[mob[j]-2]++;
}
for(int j=0;j<1001;j++){
eyemax=max(eyemax,eyes[j]);
}
for(int j=1000;j>0;j--){
if(eyemax==eyes[j]){
ans=j;
break;
}
}
printf("%d\n",ans);
return 0;
}
kametaro