結果

問題 No.112 ややこしい鶴亀算
ユーザー Shawn stayC
提出日時 2020-07-04 14:22:05
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 299 bytes
コンパイル時間 1,331 ms
コンパイル使用メモリ 166,472 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-19 00:38:38
合計ジャッジ時間 2,085 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)

int main(){
	int n; cin>>n;
	int ans=0;
	rep(i,n){
		int a; cin>>a;
		ans+=a;
	}
	int turu=4*n*n-4*n;
	int kame=2*n*n-2*n;
	int r=2*(n-1);
	turu=(turu-ans)/r;
	kame=(ans-kame)/r;
	cout<<turu<<" "<<kame<<endl;
}
0