| Task: | Bittijono |
| Sender: | kapesu8 |
| Submission time: | 2016-10-06 14:15:20 +0300 |
| Language: | C++ |
| Status: | COMPILE ERROR |
Compiler report
input/code.cpp: In function 'void p(int, int, int)':
input/code.cpp:10:37: error: 'pow' was not declared in this scope
int a = int(pow(double(-1),counter));
^
input/code.cpp:17:53: error: 'log' was not declared in this scope
p(counter+1,x - s/2,pow(2,ceil(log(double(x - s/2))/log(double(2)))));
^
input/code.cpp:17:69: error: 'ceil' was not declared in this scope
p(counter+1,x - s/2,pow(2,ceil(log(double(x - s/2))/log(double(2)))));
^
input/code.cpp:17:70: error: 'pow' was not declared in this scope
p(counter+1,x - s/2,pow(2,ceil(log(double(x - s/2))/log(double(2)))));
^
input/code.cpp: In function 'int main()':
input/code.cpp:29:50: error: 'log' was not declared in this scope
float closest = pow(2,ceil(log(double(this_int))/log(double(2))));...Code
#include <iostream>
#include <string>
#define uint unsigned int
void p(int counter,int x,int s)
{
if(s == 1)
{
int a = int(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;
bool first = false;
std::cin >> count;
for(int a = 0;a < count;a++)
{
int this_int;
std::cin >> this_int;
float 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;
}
