View Code of Problem 70

#include<bits/stdc++.h>
using namespace std;
int main()
{
	long int x;
	while (cin >> x) {
		if (x <= 100000) {
			cout << x * 0.1<<endl;
		}
		if (100000 < x&&x <= 200000) {
			cout << 100000 * 0.1 + (x - 100000)*0.75<<endl;
		}
		if (200000 < x&&x <= 400000) {
			cout << 100000 * 0.1 + 100000 * 0.75 + (x - 200000)*0.05 <<endl;
		}
		if (400000 < x&&x <= 600000) {
			cout << 100000 * 0.1 + 100000 * 0.75 + 200000 * 0.05 + (x - 400000)*0.03 <<endl;
		}
		if (600000 < x&&x <= 1000000) {
			cout << 100000 * 0.1 + 100000 * 0.75 + 200000 * 0.05 + 200000 * 0.03 + (x - 600000)*0.15 <<endl;
		}
		if (x > 1000000) {
			cout << 100000 * 0.1 + 100000 * 0.75 + 200000 * 0.05 + 200000 * 0.03 + 400000 * 0.15 + (x - 1000000)*0.01 <<endl;
		}
	}
}

Double click to view unformatted code.


Back to problem 70