結果
問題 | No.112 ややこしい鶴亀算 |
ユーザー |
![]() |
提出日時 | 2016-03-01 11:05:59 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 574 bytes |
コンパイル時間 | 838 ms |
コンパイル使用メモリ | 66,912 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-24 13:02:39 |
合計ジャッジ時間 | 1,856 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 23 |
ソースコード
#include <iostream> #include <algorithm> #include <vector> #include <cmath> using namespace std; int main(){ int n,maxleg = 0,minleg = 200; cin >> n; vector<int> a; for(int i = 0;i < n;i++){ int atmp; cin >> atmp; a.push_back(atmp); maxleg = max(maxleg,a[i]); minleg = min(minleg,a[i]); } if(maxleg == minleg){ if(maxleg / (n - 1) == 2) cout << n << " 0" << endl; else cout << "0 " << n << endl; }else{ int crane = count(a.begin(),a.end(),maxleg); cout << crane << ' ' << n - crane << endl; } }