結果

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

テストケース

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

ソースコード

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++){
		__float128 past = 1.0;
		for (int j = 1; j <= i; j++){
			past *= (__float128)(j);
		}
		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 /= past;
						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