hiho week 148 register

Ended

Participants:382

Verdict:Accepted
Score:100 / 100
Submitted:2017-04-30 00:04:40

Lang:GCC

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>
int a[1000];
int need_lines(int n,int num){
    int sum=0;
    while(n){
        n--;
        sum+=(a[n]-1)/num+1;
    }
    return sum;
}
void scan_array(int n){
    int i=0;
    while(i<n){
        scanf("%d",&a[i]);
        i++;
    }
}
void run(){
    int N,P,W,H,S;
    scanf("%d%d%d%d",&N,&P,&W,&H);
    scan_array(N);
    S=W<H?W:H;
    while(S){
        if((need_lines(N,W/S)-1)/(H/S)+1<=P) break;
        S--;
    }
    printf("%d\n",S);
}
int main(){
    int TASKS;
    scanf("%d",&TASKS);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX