結果

問題 No.112 ややこしい鶴亀算
ユーザー ldsyb
提出日時 2016-03-01 11:13:30
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 500 bytes
コンパイル時間 600 ms
コンパイル使用メモリ 61,492 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-24 13:03:16
合計ジャッジ時間 1,398 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;

int main(){
   int n,maxleg = 0,minleg = 200;
   cin >> n;
   int a[n];
   for(int i = 0;i < n;i++){
      cin >> a[i];
      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,a + n,maxleg);
      cout << crane << ' ' << n - crane << endl;
   }
}
0