답안 #44784

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
44784 2018-04-06T11:37:50 Z tjd229 질문 (CEOI14_question_grader) C++11
컴파일 오류
0 ms 0 KB
int digit12[924];
void n2digit12(){
	int i1, i2, i3, i4, i5, i6;
	int ix = 0;
	for (i1 = 0; i1 < 12; i1++){
		for (i2 = i1 + 1; i2 < 12; i2++){
			for (i3 = i2 + 1; i3 < 12; i3++){
				for (i4 = i3 + 1; i4 < 12; i4++){
					for (i5 = i4 + 1; i5 < 12; i5++){
						for (i6 = i5 + 1; i6 < 12; i6++){
							digit12[ix++] = (1 << i1) + (1 << i2) + (1 << i3)
								+ (1 << i4) + (1 << i5) + (1 << i6);
						}
					}
				}
			}
		}
	}
}
int encode(int n, int x, int y) {
	static bool flag = true;
	if (flag) n2digit12(), flag = false;
	int bit = 1;
	for (int i = 0; i < 12; i++,bit<<=1){
		if ((digit12[x] & bit) && !(digit12[y] & bit))
			return i + 1;
	}
	return 0;
}

int digit12[924];

void n2digit12(){
	int i1, i2, i3, i4, i5, i6;
	int ix = 0;
	for (i1 = 0; i1 < 12; i1++){
		for (i2 = i1 + 1; i2 < 12; i2++){
			for (i3 = i2 + 1; i3 < 12; i3++){
				for (i4 = i3 + 1; i4 < 12; i4++){
					for (i5 = i4 + 1; i5 < 12; i5++){
						for (i6 = i5 + 1; i6 < 12; i6++){
							digit12[ix++] = (1 << i1) + (1 << i2) + (1 << i3)
								+ (1 << i4) + (1 << i5) + (1 << i6);
						}
					}
				}
			}
		}
	}
}

int decode(int n, int q, int h) {
	static int flag = true;
	if (flag) dec::n2digit12(),flag=false;
	int bit = 1 << (h - 1);
	return (dec::digit12[q] & bit) != 0;	
}

Compilation message

decoder.cpp: In function 'int decode(int, int, int)':
decoder.cpp:26:12: error: 'dec' has not been declared
  if (flag) dec::n2digit12(),flag=false;
            ^~~
decoder.cpp:28:10: error: 'dec' has not been declared
  return (dec::digit12[q] & bit) != 0; 
          ^~~