|
|
back to boardDiscussion of Problem 1113. Jeephelp !!!why wrong answer? #include<fstream.h> int main() { int n=1; float h=1.0; float s=0; long N; double M; double k=0; double d1; long d; cin>>N;cin>>M; if(M>N) {cout<<N; return 0; } k=N/M-1; for(;;n++) { s=s+h/(2*n+1); if(s>k) break; } d1=(((k-s)*(2*n+1)+1)*M+n*M); d=long(d1); if(d1-d>0) d=d+1; cout<<d; return 0; } |
|
|