|
|
back to boardTO ADMINS>>here my pro. What is wrong with my programm. WA test#1 but it works normally on my computer actually i don't understand what is the matter of it? give me some more tests: HERE my program: #include <iostream> using namespace std; int a[30],contr=0,n,s=0; int main() { int i; cin>>n; for(i=0;i<100;i++) a[i]=0; int f(int x); bool pr=true; while(n>=10) { f(n); contr++; if(contr!=s) { cout<<-1<<endl; n=5; pr=false; } } if(n==0) { cout<<"10"<<endl; pr=false; } if(pr) { a[s]=n; for(i=s;i>=0;i--) cout<<a[i]; cout<<endl; } return 0; } int f( int k) { int i; for(i=9;i>1;i--) if(k%i==0) { n/=i; a[s++]=i; break; } return n; } Re: TO ADMINS>>here my pro. What is wrong with my programm. Posted by Madhav 13 Jun 2008 19:38 Check your program once again.It is giving wrong answer to sample input.It is outputing 10 for sample input |
|
|