Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
 User ID: Password:
Register

## 为什么printf("%lf")WA,printf("%f")AC?

Posted by ibilllee at 2018-07-05 21:59:02 on Problem 1759
```#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include <iomanip>
#include<algorithm>
#define RG register int
#define rep(i,a,b)    for(RG i=a;i<=b;++i)
#define per(i,a,b)    for(RG i=a;i>=b;--i)
#define ll long long
#define inf (1<<29)
#define maxn 1005
#define eps 1e-8
using namespace std;
int n;
double a,ans=1e20;
double H[maxn];
inline int read()
{
int x=0,f=1;char c=getchar();
while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
return x*f;
}

int check(double b)
{
double A=a,B=b,C;
rep(i,3,n)
{
C=2.0*B+2.0-A;
if(C<0)	return 0;
A=B,B=C;
}
ans=min(ans,C);
return 1;
}

int main()
{
n=read();scanf("%lf",&a);
double l=-1,r=1030,mid;
while(r-l>eps)
{
mid=(l+r)/2;
if(check(mid))	r=mid;
else			l=mid;
}
printf("%.2f",ans);//printf("%.2lf",ans);waaaaa?
return 0;
}```

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator