0_0_20612564_16648.cpp:5:18: error: expected unqualified-id before numeric constant
#define EPS (1e-8)double dp[1010];using namespace std;double cal(double a,double b,double pre,double p) { return (p-pre)/(1+pow(p-a,b));}double get_max(int a,double b,double pre) { double l = a+1 ,r = 1e10; while(abs(l-r)>
^
0_0_20612564_16648.cpp:6:5: note: in expansion of macro 'EPS'
EPS) { double mid = (l+r)/2.0,mmid = (r+mid)/2.0; if(cal(a,b,pre,mmid)<cal(a,b,pre,mid)) r = mmid; else l = mid; } int ans = l; return cal(a,b,pre,ans)>cal(a,b,pre,ans+1)?cal(a,b,pre,ans):cal(a,b,pre,ans+1);}double get(double a,double b,int n) { dp[0] = a; for(int i(1);i!=n;++i) dp[i] = dp[i-1] + get_max(a,b,dp[i-1]); return dp[n-1];}int main() { double a,b,n; int t(0); while(cin>>n) { if(n==0) break; cin>>a>>b; printf("Case %d: %.2lf\n",++t,get(a,b,n)); } return 0;}
^
0_0_20612564_16648.cpp:5:18: error: expected ')' before numeric constant
#define EPS (1e-8)double dp[1010];using namespace std;double cal(double a,double b,double pre,double p) { return (p-pre)/(1+pow(p-a,b));}double get_max(int a,double b,double pre) { double l = a+1 ,r = 1e10; while(abs(l-r)>
^
0_0_20612564_16648.cpp:6:5: note: in expansion of macro 'EPS'
EPS) { double mid = (l+r)/2.0,mmid = (r+mid)/2.0; if(cal(a,b,pre,mmid)<cal(a,b,pre,mid)) r = mmid; else l = mid; } int ans = l; return cal(a,b,pre,ans)>cal(a,b,pre,ans+1)?cal(a,b,pre,ans):cal(a,b,pre,ans+1);}double get(double a,double b,int n) { dp[0] = a; for(int i(1);i!=n;++i) dp[i] = dp[i-1] + get_max(a,b,dp[i-1]); return dp[n-1];}int main() { double a,b,n; int t(0); while(cin>>n) { if(n==0) break; cin>>a>>b; printf("Case %d: %.2lf\n",++t,get(a,b,n)); } return 0;}
^
0_0_20612564_16648.cpp: In function 'double get_max(int, double, double)':
0_0_20612564_16648.cpp:6:8: error: expected primary-expression before ')' token
EPS) { double mid = (l+r)/2.0,mmid = (r+mid)/2.0; if(cal(a,b,pre,mmid)<cal(a,b,pre,mid)) r = mmid; else l = mid; } int ans = l; return cal(a,b,pre,ans)>cal(a,b,pre,ans+1)?cal(a,b,pre,ans):cal(a,b,pre,ans+1);}double get(double a,double b,int n) { dp[0] = a; for(int i(1);i!=n;++i) dp[i] = dp[i-1] + get_max(a,b,dp[i-1]); return dp[n-1];}int main() { double a,b,n; int t(0); while(cin>>n) { if(n==0) break; cin>>a>>b; printf("Case %d: %.2lf\n",++t,get(a,b,n)); } return 0;}
^
0_0_20612564_16648.cpp: In function 'double get(double, double, int)':
0_0_20612564_16648.cpp:6:251: error: 'dp' was not declared in this scope
EPS) { double mid = (l+r)/2.0,mmid = (r+mid)/2.0; if(cal(a,b,pre,mmid)<cal(a,b,pre,mid)) r = mmid; else l = mid; } int ans = l; return cal(a,b,pre,ans)>cal(a,b,pre,ans+1)?cal(a,b,pre,ans):cal(a,b,pre,ans+1);}double get(double a,double b,int n) { dp[0] = a; for(int i(1);i!=n;++i) dp[i] = dp[i-1] + get_max(a,b,dp[i-1]); return dp[n-1];}int main() { double a,b,n; int t(0); while(cin>>n) { if(n==0) break; cin>>a>>b; printf("Case %d: %.2lf\n",++t,get(a,b,n)); } return 0;}
^
|