Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
You need not to go up to
_n / 2
to check whether a number is a prime.Also, the hash is useless in this regard, the
isprime
and loop are sufficient to solve it!OP solved it, closing
n
is of typeint
so your cast tolong long
has no effect since it is downcasted toint
again immediately. Thus you are only doingint
-calculations in your return statement. Assign thelong long
to a new variable and it will work.Anything? If your code crashes, then your memory handling must be wrong.
This comment is hidden because it contains spoiler information about the solution
tried it as well,
dont know why i still get the error message:
main.cpp:193:9: error: invalid operands to binary expression ('stringstream' (aka 'basic_stringstream') and 'X')
out << X();
~~~ ^ ~~~
/usr/include/c++/v1/ostream:191:20: note: candidate function not viable: no known conversion from 'X' to 'std::__1::basic_ostream &()(std::__1::basic_ostream &)' for 1st argument
basic_ostream& operator<<(basic_ostream& (__pf)(basic_ostream&));
Segfault.
This comment is hidden because it contains spoiler information about the solution
I have the same problem, in c lang the last test crashes
This comment is hidden because it contains spoiler information about the solution
in c language, i pass all the test but last one crashes,
i get this error code:
"Test Crashed
Exit code: 0
Signal code: 6"
what could i be doiing wrong?
Using RegEx should be cheating... ;)
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Tests for 1 and 10 are successful, but test for 40 comes out wrong:
right answer is 1.4788962720000001 , but got: 1.4235528840000000.
any idea why can it be?
Loading more items...