c - ProjectEuler' 8: solution works for example but can't find answer -


I am learning and trying to improve my skills, through which the project is practicing with owl. I'm left with

This is my code:

  #include & lt; Stdio.h & gt; #include & lt; String.h & gt; # Include & lt; Stdin # ADJ_GRAB4UIT64_T max_prod; // takes a four array and has changed int array int * arr_atoi (const char nos []) {static int c_ints [ADJ_GRAB]; Int nos_len = Stellen (number); Int z; For (z = 0; z  

How many adjacent points you can modify while modifying ADJ_GRAB If you run it with four, as in the example of the problem, the product is 5832 (which is the right product), but if you run it from 13, the product is not correct.

Thank you.

Part 1: The number of bits

Your Solutions integer suffers from overflow Mathematics on a int , which is likely to be a 32 bit number.

By scanning the problem spot, I came across:

  9 * 7 * 5 * 3 * 6 * 9 * 7 * 8 * 1 * 7 * 9 * 7 * 7 == 8,821,658,160 == 0x2_0DCF_D230  

Which is 34 bit unsigned) Number.

Part 2: Compiler should provide better warnings

  blue.cc:34:33: warning: format specifies that 'unsigned' int 'but argument Type 'uint64_t' (aka 'unsigned long-term') [- format] printf ("% u \ n", max_prod); ~~ ^ ~~~~~~~% llu  

You are not matching the printf format with string logic, probably you have something like "% llu" needed.


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -