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

wa4
Posted by Experimenter 29 Sep 2008 22:57
i had wa4.
when i change code like


  while(a[i]>1)
  {
   b=1;
   for(int j=2; j<=sqrt((double)a[i]); j++)if(a[i]%j==0)
   {
    aa[j]++;
    a[i]/=j;
    b=0;
   }
   if(b)
   {
    aa[a[i]]++;
    a[i]=1;
   }
  }

 to

  while(a[i]>1)
  {
   b=1;
   for(int j=2; j<=sqrt((double)a[i]); j++)if(a[i]%j==0)
   {
    while(a[i]%j==0)
    {
     aa[j]++;
     a[i]/=j;
    }
    b=0;
   }
   if(b)
   {
    aa[a[i]]++;
    a[i]=1;
   }
  }

i get ac... why? can u give me bad test for first??