View Code of Problem 70

#include<iostream>
#include<vector>
#include<iomanip>
using namespace std;
int main() {
	int n;
	while (cin >> n) {
		cout << fixed << setprecision(0);
		if (n <= 100000)cout << n / 10;
		else if (n <= 200000)cout << 10000 + (n - 100000)*0.075;
		else if (n <= 400000)cout << 10000 + 100000 * 0.075 + (n - 200000)*0.05;
		else if (n <= 600000)cout << 10000 + 100000 * 0.075 + 200000 * 0.05 + (n - 400000)*0.03;
		else if (n <= 1000000)cout << 10000 + 100000 * 0.075 + 200000 * 0.05 + 200000 * 0.03 + (n - 600000)*0.015;
		else cout << 10000 + 100000 * 0.075 + 200000 * 0.05 + 200000 * 0.03 + 400000 * 0.015 + (n - 1000000)*0.01;
		cout << endl;
	}
}

Double click to view unformatted code.


Back to problem 70