Submission #26689

# Submission time Handle Problem Language Result Execution time Memory
26689 2017-07-05T02:22:38 Z grands Question (Grader is different from the original contest) (CEOI14_question_grader) C++14
Compilation error
0 ms 0 KB
#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;

}

Compilation message

encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:5:16: error: 'itoa' was not declared in this scope
  itoa(n, str, 2);
                ^

decoder.cpp: In function 'int decode(int, int, int)':
decoder.cpp:6:16: error: 'itoa' was not declared in this scope
  itoa(n, str, 2);
                ^
decoder.cpp:10:2: error: 'cout' was not declared in this scope
  cout << (temp == 0) << endl;
  ^
decoder.cpp:10:25: error: 'endl' was not declared in this scope
  cout << (temp == 0) << endl;
                         ^
decoder.cpp:13:23: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
  int mask = (1 << bit + 1) - 1;
                       ^
decoder.cpp:19:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^