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 1014. Product of Digits

TO ADMINS>>here my pro. What is wrong with my programm.
Posted by Rustambek_UWED 10 Apr 2008 21:30
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