/ SB域 /

记录详情

Wrong Answer


  
# 状态 耗时 内存占用
#1 Accepted 3ms 384.0 KiB
#2 Accepted 3ms 360.0 KiB
#3 Wrong Answer 4ms 336.0 KiB
#4 Wrong Answer 3ms 348.0 KiB
#5 Wrong Answer 2ms 352.0 KiB
#6 Wrong Answer 3ms 340.0 KiB
#7 Wrong Answer 2ms 364.0 KiB
#8 Wrong Answer 3ms 376.0 KiB
#9 Wrong Answer 3ms 368.0 KiB
#10 Accepted 2ms 360.0 KiB

代码

#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;

int n;
double ans,k,k2,add;

inline void read(int &x);

int main()
{
	read(n);
	
	ans=add=420000.0/n; k=1;
	
	for(int i=2; i<=n; i++)
	{
		k=(1-k2)/2;
		k2=k/2;
		ans+=add*k;
	}
	printf("%.2lf\n",ans);
	
	return 0;
}

inline void read(int &x)
{
	x=0;
	int s=1;
	char c=getchar();
	while(c<'0' || c>'9') {if(c=='0') s=-1; c=getchar();}
	while(c>='0' && c<='9') {x=x*10+c-'0'; c=getchar();}
	
	x*=s;
}

信息

递交者
类型
递交
题目
烧水问题
题目数据
下载
语言
C++
递交时间
2018-09-22 20:38:18
评测时间
2018-09-22 20:38:18
评测机
分数
30
总耗时
33ms
峰值内存
384.0 KiB