結果

問題 No.112 ややこしい鶴亀算
ユーザー dora_maruta
提出日時 2014-12-24 16:03:28
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 614 bytes
コンパイル時間 612 ms
コンパイル使用メモリ 54,888 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-12 04:55:08
合計ジャッジ時間 1,494 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
int m[50*4+1];

int main(){
	int n;
	std::cin >> n;
	for (int i = 0; i < n; ++i){
		int a; 
		std::cin >> a;
		m[a]++;
	}
	int cnt = 0;
	int turu = 0;
	int kame = 0;
	int turun = 0; 
	int kamen = 0;
	for (int i = 0; i < 201; ++i){
		if (m[i] != 0){
			turu == 0 ? turu = m[i] : kame = m[i];
			turun == 0 ? turun = i : kamen = i;
		}
	}
	if (turun>kamen)std::swap(turun, kamen);
	if (kame == 0){
		if (turu * 2 == turun)std::cout << kame << " " << turu << std::endl;
		else std::cout << turu << " " << kame << std::endl;
	}
	else{
		std::cout << kame << " " << turu << std::endl;
	}
	return 0;
}
0