|  | 
|  | 
| вернуться в форум | Discuss calculation for n=4 Can you help me with mathematic calculation, I can't get 670. First I use next algorithm to count lycky integers, and he is quite good as you see:
 double a[8];
 int k = 0;
 bool log = false;
 if (n == 4)
 {
 do
 {
 a[k] = broj % 10;
 broj = broj / 10;
 k = k + 1;
 }
 while (broj != 0);
 if ( a[0]+a[1] == a[2]+a[3])
 log = true;
 
 He gets result 615. After that I calculate how many 4 digit lucky numbers which begins with zero have, and I get 18. That is 615+18 = 643.
 Did I miss something?
 Obviosly I did, but I can't see, please help!
Re: Discuss calculation for n=4 Послано u7gN  9 июл 2006 01:24simply try to use function div_t, u can find it in index. | 
 | 
|