hiho week 189 register

Ended

Participants:100

Verdict:Accepted
Score:100 / 100
Submitted:2018-02-12 12:10:04

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
29
30
31
#include <cstdio>
#include <cmath>
using namespace std;
// 90, 1 case failed. Use the default settings of "Cout" cause this issue.
// Change to printf fix that
inline double calculate(double k){
    return log(k + 1) - log(k);
}
int main(){
    int pillCnt, attCnt;
    scanf("%d %d", &pillCnt, &attCnt);
    int c[11], b[11];
    for(int i = 0; i < attCnt; ++i) scanf("%d", &c[i]);
    for(int i = 0; i < attCnt; ++i) scanf("%d", &b[i]);
    for(int i = 0; i < pillCnt; ++i){
        int maxIndex = 0;
        for(int j = 1; j < attCnt; ++j){
            if (calculate(c[j]) * b[maxIndex] > calculate(c[maxIndex]) * b[j]){
                maxIndex = j;
            }
        }
        c[maxIndex]++;
    }
    // long double ans = 0;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX