|
|
back to boardI have a misstake pls help! #include<iostream> using namespace std; int a[50000],b[50000],k=0,z=0; void pra(int f){ int i;
for(i=2;i<=f;i++){ while(f%i==0){ f/=i; a[k]=i; k++; } } } void prb(int a){ int i; for(i=2;i<=a;i++){ while(a%i==0){ a/=i; b[z]=i; z++; } } } int main(){ int n,m,i,j,br=0; cin>>n>>m; for(i=n-m+1;i<=n;i++) pra(i); for(i=2;i<=m;i++) prb(i); sort(a,a+k); sort(b,b+z); for(i=0;i<50000;i++){ for(j=0;j<50000;j++){ if(a[i]==b[j]){ a[i]=0; b[j]=0; break; } } } for(i=0;i<50000;i++){ if(a[i]) br++; } cout<<br<<endl; system("pause"); return 0; } This is my sourse and it works for some of the tests, but not for the all! So i have a problem on test 2. Can you tell me what to edit? 10x |
|
|