Submission #3510659


Source Code Expand

Copy
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

long double n, p, ans;

int main()
{
	in >> n;
	p = 1. / n;
	ans += p * (n + 1.) / 2.;
	for (int i = 3; i <= n + 1; ++i)
	{
		p /= i - 2.;
		p /= n;
		p *= n - (i - 2.);
		p *= i - 1.;
		ans += p * (i - 1.) * (n + 1.) / 2.;
	}
	out << std::fixed << std::setprecision(14);
	out << ans << std::endl;
	return 0;
}

Submission Info

Submission Time
Task E - デフレゲーム
User Bwambocos
Language C++14 (GCC 5.4.1)
Score 500
Code Size 468 Byte
Status
Exec Time 191 ms
Memory 256 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample_01.txt, sample_02.txt
Subtask1 60 / 60 sample_01.txt, sample_02.txt, subtask1_in1.txt, subtask1_in2.txt, subtask1_in3.txt, subtask1_in4.txt
Subtask2 120 / 120 sample_01.txt, sample_02.txt, subtask1_in1.txt, subtask1_in2.txt, subtask1_in3.txt, subtask1_in4.txt, subtask2_in1.txt, subtask2_in2.txt, subtask2_in3.txt, subtask2_in4.txt, subtask2_in5.txt, subtask2_in6.txt
Subtask3 320 / 320 sample_01.txt, sample_02.txt, subtask1_in1.txt, subtask1_in2.txt, subtask1_in3.txt, subtask1_in4.txt, subtask2_in1.txt, subtask2_in2.txt, subtask2_in3.txt, subtask2_in4.txt, subtask2_in5.txt, subtask2_in6.txt, subtask3_in1.txt, subtask3_in10.txt, subtask3_in11.txt, subtask3_in12.txt, subtask3_in13.txt, subtask3_in14.txt, subtask3_in15.txt, subtask3_in16.txt, subtask3_in17.txt, subtask3_in18.txt, subtask3_in19.txt, subtask3_in2.txt, subtask3_in20.txt, subtask3_in21.txt, subtask3_in22.txt, subtask3_in23.txt, subtask3_in24.txt, subtask3_in25.txt, subtask3_in26.txt, subtask3_in27.txt, subtask3_in28.txt, subtask3_in29.txt, subtask3_in3.txt, subtask3_in30.txt, subtask3_in4.txt, subtask3_in5.txt, subtask3_in6.txt, subtask3_in7.txt, subtask3_in8.txt, subtask3_in9.txt
Case Name Status Exec Time Memory
sample_01.txt 1 ms 256 KB
sample_02.txt 1 ms 256 KB
subtask1_in1.txt 1 ms 256 KB
subtask1_in2.txt 1 ms 256 KB
subtask1_in3.txt 1 ms 256 KB
subtask1_in4.txt 1 ms 256 KB
subtask2_in1.txt 1 ms 256 KB
subtask2_in2.txt 1 ms 256 KB
subtask2_in3.txt 1 ms 256 KB
subtask2_in4.txt 1 ms 256 KB
subtask2_in5.txt 1 ms 256 KB
subtask2_in6.txt 1 ms 256 KB
subtask3_in1.txt 1 ms 256 KB
subtask3_in10.txt 12 ms 256 KB
subtask3_in11.txt 16 ms 256 KB
subtask3_in12.txt 20 ms 256 KB
subtask3_in13.txt 32 ms 256 KB
subtask3_in14.txt 58 ms 256 KB
subtask3_in15.txt 61 ms 256 KB
subtask3_in16.txt 63 ms 256 KB
subtask3_in17.txt 83 ms 256 KB
subtask3_in18.txt 93 ms 256 KB
subtask3_in19.txt 94 ms 256 KB
subtask3_in2.txt 1 ms 256 KB
subtask3_in20.txt 104 ms 256 KB
subtask3_in21.txt 111 ms 256 KB
subtask3_in22.txt 115 ms 256 KB
subtask3_in23.txt 120 ms 256 KB
subtask3_in24.txt 132 ms 256 KB
subtask3_in25.txt 138 ms 256 KB
subtask3_in26.txt 139 ms 256 KB
subtask3_in27.txt 139 ms 256 KB
subtask3_in28.txt 152 ms 256 KB
subtask3_in29.txt 176 ms 256 KB
subtask3_in3.txt 1 ms 256 KB
subtask3_in30.txt 191 ms 256 KB
subtask3_in4.txt 1 ms 256 KB
subtask3_in5.txt 2 ms 256 KB
subtask3_in6.txt 2 ms 256 KB
subtask3_in7.txt 2 ms 256 KB
subtask3_in8.txt 2 ms 256 KB
subtask3_in9.txt 7 ms 256 KB