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 1355. Bald Spot Revisited

TLE#3
Posted by Mihran Hovsepyan {1 kurs of <RAU>} 1 Jun 2008 04:21
Please help me I really can't understand why I've got TLE#3

# include <iostream>
using namespace std;
int main ()
{
    const int prime[3409]={  here prime numbers for 2 to 31699  };
    int i,t,a[25],j,x,y;
    cin>>t;
    for(i=0;i<t;i++)
    {
        cin>>x>>y;
        if(y%x!=0)
        {
            a[i]=0;
            continue;
        }
        y/=x;
        a[i]=1;
        j=0;
        while(y>1)
        {
            if(y%prime[j]==0)
            {
                y/=prime[j];
                a[i]++;
            }
            else
                j++;
        }
    }
    for(i=0;i<t;i++)
        cout<<a[i]<<endl;
    return 0;
}

Edited by author 27.07.2008 02:32
Re: TLE#3
Posted by Kruglova Irka☺ 24 Jul 2008 16:05
I found all primes less then 100000 (it must be even more than needed)