ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1044. Lucky Tickets. Easy!

Discuss calculation for n=4
Posted by Marko Bogdanovic 3 May 2005 00:16
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
Posted by u7gN 9 Jul 2006 01:24
simply try to use function div_t, u can find it in index.