CSES - Datatähti 2017 alku - Results
Submission details
Task:Bittijono
Sender:vuolen
Submission time:2016-10-06 20:25:22 +0300
Language:C++
Status:COMPILE ERROR

Compiler report

input/code.cpp:4:1: error: 'uint8_t' does not name a type
 uint8_t get_bit(uint64_t k) {
 ^
input/code.cpp: In function 'int main()':
input/code.cpp:16:3: error: 'uint64_t' was not declared in this scope
   uint64_t k;
   ^
input/code.cpp:16:12: error: expected ';' before 'k'
   uint64_t k;
            ^
input/code.cpp:17:16: error: 'k' was not declared in this scope
   scanf("%d", &k);
                ^
input/code.cpp:18:12: error: 'get_bit' was not declared in this scope
   get_bit(k);
            ^

Code

#include <stdio.h>
#include <stdio.h>

uint8_t get_bit(uint64_t k) {
  if (k == 1)
    return 0;
  uint8_t n = 2;
  while (n < k) {
    n = pow(n, 2);
  }

  return !get_bit(k - n / 2);
}

int main(void) {
  uint64_t k;
  scanf("%d", &k);
  get_bit(k);
}