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

Compiler report

input/code.cpp: In function 'int main(int, char**)':
input/code.cpp:10:21: warning: format '%i' expects argument of type 'int*', but argument 2 has type 'int_fast64_t* {aka long int*}' [-Wformat=]
  std::scanf("%i", &n);
                   ~~^
input/code.cpp:11:47: error: 'sqrtf' is not a member of 'std'
  int_fast64_t viimeinen = (int_fast64_t)(std::sqrtf((8*n+1)/4)-0.5);
                                               ^~~~~
input/code.cpp:11:47: note: suggested alternative: 'sqrt'
  int_fast64_t viimeinen = (int_fast64_t)(std::sqrtf((8*n+1)/4)-0.5);
                                               ^~~~~
                                               sqrt
input/code.cpp:12:32: warning: format '%i' expects argument of type 'int', but argument 2 has type 'int_fast64_t {aka long int}' [-Wformat=]
  std::printf("%i \n", viimeinen);
                                ^
input/code.cpp:16:23: warning: format '%i' expects argument of type 'int', but argument 2 has type 'int_fast64_t {aka long i...

Code

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

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