标签:
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 15064 Accepted Submission(s):
3670
点我
1 #include <iostream> 2 #include <cmath> 3 using namespace std; 4 int main() 5 { 6 double v,d; 7 while(cin>>v>>d) 8 { 9 int x=int(v/d),i=1,j,t=0; 10 int n=x; 11 while(x-i>=0) 12 { 13 t=t+i; 14 x=x-i; 15 t+=1; 16 i++; 17 } 18 if(x>0) 19 { 20 t+=x; 21 if(abs(n-v/d)>0.00001) 22 t++; 23 } 24 else 25 { 26 if(abs(n-v/d)>0.00001) 27 t++; 28 else 29 t--; 30 } 31 cout<<t<<endl; 32 } 33 }
标签:
原文地址:http://www.cnblogs.com/a1225234/p/4690713.html