|
|
back to boardI got 89 for the example, not 90, why? I got 89 for the example: 2 10, not 90, why? Any one know this? Re: I got 89 for the example, not 90, why? 9*10=90; 9 - count of possible first digits (zero not allowed); 10 - count of possible second digits. How did you get 89? Re: I got 89 for the example, not 90, why? it's because of pow-function pow(10,2)==99 U may: if ( result_of_pow % 9 == 0) result_of_pow++; Edited by author 25.02.2016 17:48 Re: I got 89 for the example, not 90, why? > pow(10,2)==99 It's really weird if some language's standard library doesn't work in so visible way. User mistake is much more likely. So what is language and "pow" function declaration? Probably you use any floating numbers pow, like "C++, double pow (double base, double exponent)". In this case I expect pow returns approx. 100 (99.999 for example) and then you convert double to int in wrong way. Edited by author 25.02.2016 20:35 Re: I got 89 for the example, not 90, why? I missed placed 2 as k and 10 as n, ar, that's stupid. |
|
|