|
|
вернуться в форумWA test#2 where is the problem.
please help me. I am bored of compiling. #include <iostream> #include <cmath> using namespace std; int main() { int a,b,tub,i,j,s,n,tc,m;
cin>>n; for(i=0;i<n;i++) { s=0; tub=2; cin>>a>>b; if(a==b) { cout<<1<<endl; continue; } if(b%a) { cout<<0<<endl; continue; } if(a==1&&(b%2==0)) { a=2; s++; if(b==2) { cout<<1<<endl; continue; } } if(a==1 && b%2) { a=3; s++; if(b==3) { cout<<1<<endl; continue; } } b/=a; tc=0;
while(b!=1) { if(tub==3) tc=1; while(b%tub==0) if(b%tub==0) { b/=tub; s++; } if(tub==2) tub=3; if(b!=1&&tc==1) { for(j=tub+2;j<=b;j+=2) { for(m=2;m<=int(sqrt(double(j)));m++) { if(j%2==0) break; if(m==int(sqrt(double(j)))) tub=j; } if(tub==j) break; } } } cout<<s+1<<endl; }
return 0; } |
|
|