CSES - Datatähti 2019 alku - Results
Submission details
Task:Kolikot
Sender:EA999
Submission time:2018-10-02 21:34:34 +0300
Language:C++
Status:COMPILE ERROR

Compiler report

input/code.cpp: In function 'int main(int, char**)':
input/code.cpp:12:32: error: 'floorl' is not a member of 'std'
  int_fast64_t viimeinen = std::floorl(std::sqrt(2*n +0.25)-0.5);
                                ^~~~~~
input/code.cpp:12:32: note: suggested alternative: 'floor'
  int_fast64_t viimeinen = std::floorl(std::sqrt(2*n +0.25)-0.5);
                                ^~~~~~
                                floor
input/code.cpp:11:12: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  std::scanf("%ld", &n);
  ~~~~~~~~~~^~~~~~~~~~~

Code

#include <iostream>
#include <chrono>
#include <math.h>
#include <cmath>

int main(int argc, char *argv[])
{
	std::cin.tie(NULL);
	std::ios_base::sync_with_stdio(false);
	int_fast64_t n=0;
	std::scanf("%ld", &n);
	int_fast64_t viimeinen = std::floorl(std::sqrt(2*n +0.25)-0.5);
	std::printf("%ld \n", viimeinen);
	register int_fast64_t i;
	for(i=1; i < viimeinen;i++)
	{
		std::printf("%ld ", i);
	}
	std::printf("%ld",n-((viimeinen-1)*i/2));
	std::cin >> n;
	return 0;
}