結果
問題 | No.79 過小評価ダメ・ゼッタイ |
ユーザー |
![]() |
提出日時 | 2022-11-15 22:30:31 |
言語 | C++11 (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 503 bytes |
コンパイル時間 | 1,250 ms |
コンパイル使用メモリ | 162,632 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-16 21:13:01 |
合計ジャッジ時間 | 2,675 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 |
other | AC * 8 WA * 14 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:12:15: warning: ‘th’ may be used uninitialized in this function [-Wmaybe-uninitialized] 12 | int number, th; | ^~
ソースコード
#include <bits/stdc++.h> using namespace std; #include <stdio.h> #include <iomanip> #include <iostream> #include <string> #include <algorithm> int main(){ int a; cin >> a; int number, th; vector<int> vec(a); for(int i=0; i<a;i++){ cin >> vec.at(i); } sort(vec.begin(),vec.end()); for(int i=0; i<6;i++){ int b = count(vec.begin(),vec.end(),i); if(number==b){ th = max(i,th); } else if(max(number,b)==b){ number = b; th = i; } } cout << th; }