View Code of Problem 70

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	while (cin >> n) {
		if (n <= 100000) {
			cout << n * 0.1<<endl;
		}
		if (100000 < n&&n <= 200000) {
			cout << 10000 + (n - 100000)*0.075<<endl;
		}
		if (200000 < n&&n <= 400000) {
			cout << 17500 + (n - 200000)*0.05<<endl;
		}
		if (400000 < n&&n <= 600000) {
			cout << 17500 + 200000 * 0.05 + (n - 400000)*0.03<<endl;
		}
		if (600000 < n&&n <= 1000000) {
			cout << 17500 + 200000 * 0.08 + (n - 600000)*0.015<<endl;
		}
		if (n > 1000000) {
			cout << 17500 + 200000 * 0.11 + (n - 1000000)*0.01<<endl;
		}
	}
}

Double click to view unformatted code.


Back to problem 70