結果
問題 | No.79 過小評価ダメ・ゼッタイ |
ユーザー |
![]() |
提出日時 | 2022-04-26 22:50:15 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 17 ms / 5,000 ms |
コード長 | 356 bytes |
コンパイル時間 | 527 ms |
コンパイル使用メモリ | 71,320 KB |
最終ジャッジ日時 | 2025-01-28 22:02:20 |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:26:17: warning: ‘ans’ may be used uninitialized [-Wmaybe-uninitialized] 26 | cout << ans << endl; | ^~~ main.cpp:19:13: note: ‘ans’ was declared here 19 | int ans; | ^~~
ソースコード
#include <iostream> #include <string> #include <vector> using namespace std; int main() { int N; cin >> N; vector<int> L(6+1, 0); int tmp; for( int i = 0; i < N; i++ ) { cin >> tmp; L[tmp]++; } tmp = 0; int ans; for( int i = 1; i <= 6; i++ ) { if( tmp <= L[i] ) { ans = i; tmp = L[i]; } } cout << ans << endl; return 0; }