Submission #11609276


Source Code Expand

#include <bits/stdc++.h>
using namespace std;

int justpoint01(int n, int i) {
  int A = 0;
  for (int j = 1; j < n + 1; j++) {
    A += j;
    if (0 <= A - N && A - N < j) {
      i = j;
      break;
    }
    return A,i;
  }
}

void justpoint02(int a, int n, int i) {
  bitset<i> B;
  for (int j = 0; j < i; j++) {
    B.set(j, 1);
  }
  for (int j = 0; j < i + 1; j++) {
    if (a - j == n) {
      B.set(j - 1, 0);
      break;
    }
  }
  for (int j = 0; j < i; j++) {
    if (B.test(j) == 1) {
      cout << j + 1 << endl;
    }
  }
  return;
}

int main() {
  
  int N;
  cin >> N;
  
  justpoint01(N, i);
  justpoint02(A, N, i);
  
}

Submission Info

Submission Time
Task B - Exactly N points
User Lei_01
Language C++14 (GCC 5.4.1)
Score 0
Code Size 685 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int justpoint01(int, int)’:
./Main.cpp:8:18: error: ‘N’ was not declared in this scope
     if (0 <= A - N && A - N < j) {
                  ^
./Main.cpp: In function ‘void justpoint02(int, int, int)’:
./Main.cpp:17:11: error: ‘i’ is not a constant expression
   bitset<i> B;
           ^
./Main.cpp:17:11: note: in template argument for type ‘long unsigned int’ 
./Main.cpp:19:7: error: request for member ‘set’ in ‘B’, which is of non-class type ‘int’
     B.set(j, 1);
       ^
./Main.cpp:23:9: error: request for member ‘set’ in ‘B’, which is of non-class type ‘int’
       B.set(j - 1, 0);
         ^
./Main.cpp:28:11: error: request for member ‘test’ in ‘B’, which is of non-class type ‘int’
     if (B.test(j) == 1) {
           ^
./Main.cpp: In function ‘int main()’:
./Main.cpp:40:18: error: ‘i’ was not declared in this scope
   justpoint01(N, i);
                  ^
./Main.cpp:41:15: error: ‘A’ was not declared in this scope
   justpoint02(A, N, i);
               ^