|
|
back to boardTLE#3 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 I found all primes less then 100000 (it must be even more than needed) |
|
|