結果
| 問題 |
No.706 多眼生物の調査
|
| コンテスト | |
| ユーザー |
gotutiyan
|
| 提出日時 | 2018-07-07 14:49:48 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 560 bytes |
| コンパイル時間 | 696 ms |
| コンパイル使用メモリ | 80,084 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-04 10:51:56 |
| 合計ジャッジ時間 | 1,276 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | AC * 3 WA * 2 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:30:11: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized]
30 | cout<<ans<<endl;
| ^~~
main.cpp:23:16: note: 'ans' was declared here
23 | int maxnum,ans;
| ^~~
main.cpp:25:9: warning: 'maxnum' may be used uninitialized [-Wmaybe-uninitialized]
25 | if(maxnum<=v[i]){
| ^~
main.cpp:23:9: note: 'maxnum' was declared here
23 | int maxnum,ans;
| ^~~~~~
ソースコード
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <utility>
#include <queue>
#include <stack>
#include <cmath>
#include <numeric>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
using namespace std;
int main(){
int n;
cin>>n;
vector<int> v(1010,0);
for(int i=0;i<n;i++){
string s;
cin>>s;
v[s.size()-2]++;
}
int maxnum,ans;
for(int i=0;i<n;i++){
if(maxnum<=v[i]){
maxnum=v[i];
ans=i;
}
}
cout<<ans<<endl;
}
gotutiyan