hiho week 188 register

Ended

Participants:105

Verdict:Accepted
Score:100 / 100
Submitted:2018-02-03 20:01: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 <stdio.h>
#include <stdlib.h>
#include <string.h>
int check(int ttime, int n, int m, int k, int* num){
    int i,j, atk = 0;
    for(i=0; i<n; i++){
        atk -= ttime;
        if(atk < 0){ atk = 0; }
        atk += num[i];
        if( atk >= m ){
            k--;
            atk = 0;
        }
    }
    if(k > 0){
        return 1;
    }else{
        return 0;
    }
}
int main(){
    int i,j, n,m,k, ans;
    scanf("%d %d %d", &n, &m, &k);
    int* num = (int *)calloc(n+1, sizeof(int));
    for(i=0; i<n; i++){
        scanf("%d", &num[i]);
    }
    int mid, low = 1, high = m+1;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX