結果
問題 | No.706 多眼生物の調査 |
ユーザー |
|
提出日時 | 2018-09-23 20:34:34 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 12 ms / 2,000 ms |
コード長 | 907 bytes |
コンパイル時間 | 768 ms |
コンパイル使用メモリ | 74,460 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-14 14:37:51 |
合計ジャッジ時間 | 1,338 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge6 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 5 |
ソースコード
#include<iostream>#include<string>#include<vector>#include<algorithm>using namespace std;int main() {//nを入力//おおきさnの配列を定義//文字列sを入力//'^'の数を数えて、数に対応する配列のindexに格納する//これをn回繰り返す//配列に格納されている値が最も大きいものを選ぶ//文字同列ならばindexの大きいほうを出力する//そのindexを出力するint n;vector<int> array;cin >> n;array.resize(1001,0);string str;int count=0;for (int i = 0;i < n;i++) {count = 0;cin >> str;for (int j = 0;j < str.size();j++) {if (str[j] == '^')count++;}array[count]++;}int maxa = 0;for (int i = 1;i <= array.size() - 2;i++) {if (array[i+1]!=0 && array[i] <= array[i + 1]) {if (array[maxa]<=array[i+1]) {maxa = i + 1;}}}cout << maxa << endl;return 0;}