답안 #26655

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
26655 2017-07-04T12:36:38 Z grands Hotter Colder (IOI10_hottercolder) C++14
25 / 100
790 ms 8184 KB
#include "grader.h"

int HC(int N){
	int prev = 1;
	int now = N;
	int h = Guess(prev);
	int g;
	while (1){
		g = Guess(now);
		//printf("%d %d\n", prev, now);
		if (g == 0) {
			//printf("%d\n", (prev + now) / 2);
			return (prev+now) / 2;
		}
		if (g < 0) {
			if (prev + 1 == now){
				//printf("hot  ");
				return prev;
			}
			else if (now + 1 == prev){
				//printf("hot2  ");
				return prev;
			}
			h = Guess(prev);
			now = ((prev + now) / 2);
		}
		if (g > 0){
			if (prev + 1 == now){
				//printf("cold1  ");
				return now;
			}
			else if(now+1==prev){
				//printf("cold2  ");
				return now;
			}
			int temp = ((prev + now) / 2 );
			prev = now;
			now = temp;
			h = g;
		}
	}
}

Compilation message

hottercolder.cpp: In function 'int HC(int)':
hottercolder.cpp:6:6: warning: variable 'h' set but not used [-Wunused-but-set-variable]
  int h = Guess(prev);
      ^
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 1272 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 27 ms 1272 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 29 ms 1272 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 790 ms 8184 KB Output isn't correct - alpha = 0.000000000000