CSES - Datatähti 2019 alku - Results
Submission details
Task:Kolikot
Sender:N00B.exe
Submission time:2018-10-07 15:00:37 +0300
Language:C++
Status:COMPILE ERROR

Compiler report

input/code.cpp:1:1: error: stray '\377' in program
 ��/ / # i n c l u d e   " s t d a f x . h " 
 
 ^
input/code.cpp:1:2: error: stray '\376' in program
 ��/ / # i n c l u d e   " s t d a f x . h " 
 
  ^
input/code.cpp:1:4: warning: null character(s) ignored
 ��/ / # i n c l u d e   " s t d a f x . h " 
 
    ^
input/code.cpp:1:6: warning: null character(s) ignored
 ��/ / # i n c l u d e   " s t d a f x . h " 
 
      ^
input/code.cpp:1:7: error: stray '#' in program
 ��/ / # i n c l u d e   " s t d a f x . h " 
 
       ^
input/code.cpp:1:8: warning: null character(s) ignored
 ��/ / # i n c l u d e   " s t d a f x . h " 
 
        ^
input/code.cpp:1:10: warning: null character(s) ignored
 ��/ / # i n c l u d e   " s t d a f x . h " 
 
          ^
input/code.cpp:1:12: warning: null character(s) ignored
 ��/ / # i n c l u d e   " s t d a f x . h " 
 
            ^
input/code.cpp:1:14: warning: null character(s) ignored
 ��/ / # i n c l u d e   " s t d a f x . h " 
 
              ^
inp...

Code

��//#include "stdafx.h"
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
//Init variables and get n
int n, ans, omit, i;
int test = 0;
scanf("%i", &n);
//Formula for the amount of stacks, derived from the properties of the sum 1+2+3+4...
ans = (int)(sqrt(8*n + 1) / 2 - 0.5);
printf("%i\n", ans);
ans++;
//Don't print this number
omit = ans*((ans+1.0)/2)-n;
for(i = 1; i <= ans; i++)
{
if(i == omit)
{ continue; }
//Logic to have proper spacing
if(n == 0)
{ printf(" "); }
else
{ n = 0; }
printf("%i", i);
test += i;
}
//And we are finished
printf("\n");
return 0;
}