View Code of Problem 70

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

Double click to view unformatted code.


Back to problem 70