Submission #21119

# Submission time Handle Problem Language Result Execution time Memory
21119 2017-04-04T17:58:27 Z yunhoo90 Cookie Clicker Alpha (GCJ14_cookie) C++11
19 / 19
0 ms 2020 KB
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <list>
#include <memory.h>

using namespace std;

int main() {
	int input_tc;
	cin >> input_tc;
	for(int tc = 1; tc <= input_tc; tc++) {
		double c, f, x;
		double d = 2.0;
		cin >> c >> f >> x;
		double ans=0;
		double tmp =0;
		double k = 0;
		while(1){
			ans += x / d;
			d += f;
			tmp += x / d + c / (d - f);
			if (ans < tmp) {
				k += x / (d-f);
				break;
			}
			ans = tmp;
			k += c / (d - f);
		}
		printf("Case #%d: %.7lf\n", tc, k);
	}
	return 0;
}

Compilation message


# Verdict Execution time Memory Grader output
1 Correct 0 ms 2020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2020 KB Output is correct