結果

問題 No.352 カード並べ
ユーザー Kmcode1Kmcode1
提出日時 2016-03-11 23:34:30
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 12 ms / 2,000 ms
コード長 1,226 bytes
コンパイル時間 951 ms
コンパイル使用メモリ 90,608 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-25 05:59:55
合計ジャッジ時間 1,286 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 7 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 3 ms
4,348 KB
testcase_07 AC 10 ms
4,348 KB
testcase_08 AC 12 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cctype>
#include<cstdlib>
#include<algorithm>
#include<bitset>
#include<cstdio>
#include<cstring>
#include<string>
#include<cctype>
#include<cstdlib>
#include<algorithm>
#include<bitset>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<ctime>
#include<complex>
#include<functional>
#include<climits>
#include<cassert>
#include<iterator>
#include<quadmath.h>
using namespace std;

#define MAX 21
int n;


int main(){
	cin >> n;
	__float128 ans = 0;
	for (int i = 0; i < n; i++){
		if (i == 0){
			ans += 1.0;
			continue;
		}
		if (i == 1){
			ans += 1.0;
			continue;
		}
		for (int j = 0; j + 1 < i; j++){
			for (int k = 1; k <= i; k++){
				for (int kk = 1; kk <= i; kk++){
					if (k != kk){
						__float128 F = k*kk;
						F /= (__float128)(i);
						F /= (__float128)(i - 1);
						F /= (__float128)(i + 1);
						ans += F;
					}
				}
			}
		}
		ans += (__float128)((__float128)1.0 / ((__float128)i + (__float128)1.0))*(__float128)(2.0);
	}
	double outt = ans;
	printf("%.16f\n", outt);
	return 0;
}
0