結果
| 問題 |
No.79 過小評価ダメ・ゼッタイ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-08-22 23:50:00 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 7 ms / 5,000 ms |
| コード長 | 488 bytes |
| コンパイル時間 | 1,582 ms |
| コンパイル使用メモリ | 166,928 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-15 12:27:29 |
| 合計ジャッジ時間 | 2,900 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:30:11: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized]
30 | cout << ans << endl;
| ^~~
main.cpp:22:14: note: 'ans' was declared here
22 | int max=0, ans;
| ^~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rep1(i, n) for(int i=1; i<(int)(n); i++)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> wi;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
vi d(7);
rep(i, n){
int l;
cin >> l;
d[l]++;
}
int max=0, ans;
rep1(i, 7){
if(max<=d[i]){
ans=i;
max=d[i];
}
}
cout << ans << endl;
return 0;
}