The story of Brine
Time limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)
Total submission (s): 14657 Accepted Submission (s): 3555
Problem description Hang brine when, if drip up to have regular, first drop a drop, stop, then drop two drops, stop for a moment, drop three drops, stop ..., now there is a problem: this bottle of salt water has a total of Vul ml, each drop is a D ml, The speed of each drop is one second (assuming that the last drop is less than D ml, then the time spent is one second), and the time of the pause is one second. When will this bottle of water be finished?
Input data contains multiple test instances, one row per instance, consisting of Vul and D, where 0<d<vul<5000.
Output for each set of test data, export the time required to suspend the brine, and the output of each instance takes up one row.
Sample Input
10 1
Sample Output
13
Authorlcy Ah Ah! Salt water droplets Story Oh! The topic is not difficult, the key is to read the topic description. Drop one drop at a time, stop, drop two drops, stop, third drop, stop for a second ——............ It means that the number of drops between two or three drops does not stop, so it can be called a continuous drip of three times. Altogether Vul ml, each drops assumes the D ml, then when the nth time successive drops, the total ml number is sn=nd (n+1)/2 Then the total droplet number is vul divided by d+n-1 a stop time, the gas dead me, on craved fart matter to forget good assembly son.
AC Code:
#include <iostream> #include <cmath>using namespace Std;int main () {double Vul,d;int n;while (Cin>>vul >>d) {for (n=1;n*d* (n+1) <vul*2;n++); Cout<<ceil (vul/d) +n-1<<endl;} return 0;}
Hangzhou Electric HDU ACM 1408 Salt water Story