CSES - Datatähti 2017 alku - Results
Submission details
Task:Bittijono
Sender:kapesu8
Submission time:2016-10-06 14:18:56 +0300
Language:C++
Status:COMPILE ERROR

Compiler report

input/code.cpp: In function 'void p(int, long long int, long long int)':
input/code.cpp:11:17: error: expected primary-expression before 'long'
   long long a = long long(pow(double(-1),counter));
                 ^

Code

#include <iostream>
#include <string>
#include <math.h>

#define uint unsigned int

void p(int counter,long long x,long long s)
{
	if(s == 1)
	{
		long long a = long long(pow(double(-1),counter));
		if(a == 1)
			std::cout << '1';
		else
			std::cout << '0';
	}
	else
		p(counter+1,x - s/2,pow(2,ceil(log(double(x - s/2))/log(double(2)))));
}

int main()
{
	int count;
	std::cin >> count;
	for(int a = 0;a < count;a++)
	{
		long long this_int;
		std::cin >> this_int;
		double closest = pow(2,ceil(log(double(this_int))/log(double(2))));
		p(1,this_int,closest);
		if(a != count - 1)
			std::cout << '\n';
	}
	return 0;
}