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 1055. Combinations

I have a misstake pls help!
Posted by Vasil Todorov 19 Feb 2009 02:06
#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