# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
26689 | grands | 질문 (CEOI14_question_grader) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <stdlib.h>
#include <string.h>
int encode (int n, int x, int y) {
char str[100] = { 0 };
itoa(n, str, 2);
int bit = strlen(str);
return (x << bit) + y;
}
#include <stdlib.h>
#include <string.h>
int decode (int n, int q, int h) {
char str[100] = { 0 };
itoa(n, str, 2);
int bit = strlen(str);
int temp = (h >> bit) ^ q;
cout << (temp == 0) << endl;
bool a = temp == 0;
if (a)return true;
int mask = (1 << bit + 1) - 1;
temp = (h&mask) ^ q;
cout << (temp == 0) << endl;
bool b = temp == 0;
if (b)return false;
}