Submission #71778

# Submission time Handle Problem Language Result Execution time Memory
71778 2018-08-25T15:29:05 Z 내일_개학이다_ㅠㅠ(#2253, mAng0) The Ant Doing Hard Work (FXCUP3_ant) C++
100 / 100
3 ms 360 KB
/*
#include<bits/stdc++.h>
int x;
int cnt = 0;
int DeliverCount(int y){
    cnt++;
    return y / x;
}

int FindK();

int main(){
    scanf("%d", &x);
    if(FindK() == x){
        printf("%d\n", cnt);
    }
}

*/
#include "ant.h"

int FindK(){
    int rett = DeliverCount(66666666);
    int ss = 1, ee = 99999999, ans = 99999999;
    if(rett > 0){
        ss = 66666666 / (rett+1) + 1;
        ee = 66666666 / rett;
        ans = ee; ee--;
    }else{
        ss = 66666667; ee = 99999998;
    }
    while(ss <= ee){
        int mid = (ss+ee)/2;
        int ret = DeliverCount(mid);
        if(ret > 0){
            ans = mid;
            ee = mid - 1;
        }else{
            ss = mid + 1;
        }
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 256 KB Correct
2 Correct 2 ms 360 KB Correct
3 Correct 3 ms 360 KB Correct
4 Correct 2 ms 360 KB Correct
5 Correct 3 ms 360 KB Correct