結果
| 問題 | No.706 多眼生物の調査 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-01-02 13:46:37 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 426 bytes |
| 記録 | |
| コンパイル時間 | 1,595 ms |
| コンパイル使用メモリ | 191,408 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-05-13 13:22:39 |
| 合計ジャッジ時間 | 2,058 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 5 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:27:17: warning: 'mode' may be used uninitialized [-Wmaybe-uninitialized]
27 | cout << mode << endl;
| ^~~~
main.cpp:20:22: note: 'mode' was declared here
20 | int num = 0, mode;
| ^~~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
map<int, int> mp;
int n;
cin >> n;
while(n--) {
string s;
cin >> s;
int cnt = 0;
for(int i = 0; i < s.size(); i++) {
if(s[i] == '^') cnt++;
}
mp[cnt]++;
}
int num = 0, mode;
for(auto i : mp) {
if(i.second >= num) {
num = i.second;
mode = i.first;
}
}
cout << mode << endl;
return 0;
}