답안 #28655

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
28655 2017-07-16T08:27:01 Z 핑응핑응 홍신정(#1134, owlur, elxmakdldj, haro199) Bulb Game (FXCUP2_bulb) C
0 / 1
0 ms 1132 KB
#include "bulb.h"

int button[1111];
int NN;
void Init(int N) {
	// do nothing
	NN = N;
}

int MakeTurn(int M) {
	button[M] = 1;
	for (int i = 2; i <= NN+1; i*=2) {
		if (button[(M + i) % (NN + 1)] == 0) {
			button[(M + i) % (NN + 1)] = 1;
			if ((M + i) % (NN + 1) == 0)
				return 1;
			return (M + i) % (NN + 1);
		}
	}
}

Compilation message

bulb.c: In function 'MakeTurn':
bulb.c:20:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 1132 KB Output isn't correct
2 Halted 0 ms 0 KB -