CSES - Datatähti 2017 alku - Results
Submission details
Task:Bittijono
Sender:while(false)
Submission time:2016-10-12 22:42:27 +0300
Language:C++
Status:COMPILE ERROR

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:17:28: error: 'pow' was not declared in this scope
    if (b>pow((long long)2,n)) {
                            ^

Code

//#include "stdafx.h"
#include <iostream>
using namespace std;

int a;
long long b;


int main()
{
	cin >> a;
	for (int i = a; i > 0; i--) {
		cin >> b;
		long long n = 60;
		int s = 0;
		while (n>=0) {
			if (b>pow((long long)2,n)) {
				if (s == 0) { s = 1; }
				else { s = 0; }
				b -= pow((long long)2, n);
			}
			n--;
		}
		cout << s << '\n';
	}
	//cin >> a;
    return 0;
}