hiho week 74 register

Ended

Participants:174

Verdict:Accepted
Score:100 / 100
Submitted:2015-11-29 12:38:34

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;
#define min(a,b) (((a) < (b)) ? (a) : (b))
int amounts[6] = {1500, 3000, 4500, 26000, 20000, 25000};
double rates[6] = {0.03, 0.1, 0.2, 0.25, 0.3, 0.35};
int main()
{
    double M;
    double N = 3500;
    int i;
    cin >> M;
    for(i = 0; i<6 && M>0; ++i)
    {
        N += min(M, amounts[i]*rates[i])/rates[i];
        M -= amounts[i]*rates[i];
    }
    if(M > 0)
        N += M/0.45;
    cout << int(floor(N)) << endl;
    return 0;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX