結果

問題 No.112 ややこしい鶴亀算
ユーザー yuyu_106
提出日時 2019-06-06 13:11:41
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 405 bytes
コンパイル時間 379 ms
コンパイル使用メモリ 55,376 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-25 06:25:13
合計ジャッジ時間 1,152 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstring>
using namespace std;

int main(){
	int a;
	cin >> a;
	int x;
	cin >> x;
	int y;
	int abc=0;
	for(int i=0; i<a-1; i++){
		cin >> y;
		if(y>x) abc++;
		else if(y<x) abc--;
	}
	if(abc == 0){
		if (x/(a-1) == 2)  cout << a << " 0";
		else cout << "0 " << a;
	}
	else if(abc<0)  cout << a+abc << " "<<  -abc;
	else cout << abc  << " "<< a-abc;
	cout << endl;
	return 0;
}
0