結果

問題 No.1408 Nice Dice Game
ユーザー 沙耶花
提出日時 2021-02-26 23:10:23
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,076 bytes
コンパイル時間 3,971 ms
コンパイル使用メモリ 250,336 KB
最終ジャッジ日時 2025-01-19 06:52:00
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other WA * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint1000000007;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000001


int main(){
	
	int N;
	cin>>N;
	
	if(N==1){
		cout<<fixed<<setprecision(10)<<1.2014245230<<endl;
	}
	else if(N==2){
		cout<<fixed<<setprecision(10)<<1.0823222701<<endl;
	}
	else if(N==3){
		cout<<fixed<<setprecision(10)<<1.036927755<<endl;
	}
	else{
	
	
		
		double ans = 0.0;
		/*
		
		for(double a=1.0;true;a+=1.0){
			if(a>10000000.0)break;
			for(double b=a+1.0;true;b+=1.0){
				if(a*b>10000000.0)break;
				double temp = pow(1.0/a,N) - pow(1.0/b,N);
				temp /= b;
				temp /= b-a;
				ans += temp;
			}
		}
		
		
		cout<<fixed<<setprecision(10)<<ans<<endl;
		*/
		for(double a=1.0;true;a+=1.0){
			if(a>5000.0)break;
			for(double b=a+1.0;true;b+=1.0){
				if(b>5000.0)break;
				double temp = pow(1.0/a,N) - pow(1.0/b,N);
				temp /= b;
				temp /= b-a;
				ans += temp;
			}
		}
		
		
		cout<<fixed<<setprecision(10)<<ans<<endl;
	}
		
    return 0;
}
0