結果

問題 No.706 多眼生物の調査
ユーザー gotutiyangotutiyan
提出日時 2018-07-07 14:49:48
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 560 bytes
コンパイル時間 647 ms
コンパイル使用メモリ 79,492 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-17 15:54:09
合計ジャッジ時間 1,265 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:30:11: 警告: ‘ans’ may be used uninitialized [-Wmaybe-uninitialized]
   30 |     cout<<ans<<endl;
      |           ^~~
main.cpp:23:16: 備考: ‘ans’ はここで定義されています
   23 |     int maxnum,ans;
      |                ^~~
main.cpp:25:9: 警告: ‘maxnum’ may be used uninitialized [-Wmaybe-uninitialized]
   25 |         if(maxnum<=v[i]){
      |         ^~
main.cpp:23:9: 備考: ‘maxnum’ はここで定義されています
   23 |     int maxnum,ans;
      |         ^~~~~~

ソースコード

diff #

#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;
}
0