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 1049. Brave Balloonists

Please test my code, because I think it's ok
Posted by Marko Bogdanovic 4 May 2005 06:01
Please try my program for different input data, I don't know where I am wrong. Maybe I missunderstood problem, everyone use array, I don't think it's necessary ?!

#include <iostream.h>
#include <math.h>

int main()
{
      int niz[10];
      int brojac = 1;
      int rezultat;
      int p = 1;
      int koren;
      for (int i = 0; i < 10; i++)
          cin >> niz[i];
      for (int j = 0; j < 10; j++)
          p = p * niz[j];
      if (p == 1)
      {
         cout <<1;
         return 0;
      }
      koren = floor(sqrt((double)p));

      for (int k = 2; k <=koren; k++)
      {
          if (p % k == 0)
          {
             if (p/k == k)
                brojac++;
             else
                 brojac = brojac + 2;
          }
      }
      brojac++;

          rezultat = brojac % 10;
          cout << rezultat;

      return 0;
}
Re: Please test my code, because I think it's ok
Posted by Eugene Zavgorodny 19 Jul 2007 13:22
What your answer for test:
10000
10000
10000
10000
10000
10000
10000
10000
10000
10000

For this test p=10^40.