답안 #71855

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
71855 2018-08-25T17:21:16 Z 비타오백(#2241, junodeveloper) 일하는 개미 (FXCUP3_ant) C++17
컴파일 오류
0 ms 0 KB
#include "ant.h"
int FindK() {
	int lo = 1, hi = 1e8;
	int f = 0;
	cnt = 0;
	while(lo < hi) {
		int mid = (lo + hi) / 2;
		if(!f) f = 1, mid = (1<<26)-1;
		int x = DeliverCount(mid);
		cnt++;
		if(!x) lo = mid + 1;
		else {
			lo = max(lo, (mid+x)/(x+1));
			hi = min(hi, mid/x);
		}
	}
	return lo;
}

Compilation message

ant.cpp: In function 'int FindK()':
ant.cpp:5:2: error: 'cnt' was not declared in this scope
  cnt = 0;
  ^~~
ant.cpp:5:2: note: suggested alternative: 'int'
  cnt = 0;
  ^~~
  int
ant.cpp:13:9: error: 'max' was not declared in this scope
    lo = max(lo, (mid+x)/(x+1));
         ^~~
ant.cpp:14:9: error: 'min' was not declared in this scope
    hi = min(hi, mid/x);
         ^~~
ant.cpp:14:9: note: suggested alternative: 'mid'
    hi = min(hi, mid/x);
         ^~~
         mid