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

wa #8
Posted by garra 7 Feb 2012 14:31
what is test 8  i am getting wrong  ans
Re: wa #8
Posted by morbidel 7 Feb 2012 23:17
Post your code
Re: wa #8
Posted by abid1729 24 Jun 2019 00:43
i also get wa on 8
thats my code
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a[200],i=1112,j=1;
    a[0]=1;
    long n;
    cin>>n;
    if(n<10){
            if(n==0){
                cout<<"10";
            }
            else{
        cout<<n;
            }
    }
    else{
    while(n>9&&i==1112){
        for(i=2;i<10;i++){
            if(n%i==0){
                n=n/i;
                if(a[j-1]*i<10){
                    a[j-1]=i*a[j-1];
                }else{
                a[j++]=i;
                }
                i=1111;
            }
        }
    }
    a[j]=n;
    if(n>9){
        cout<<"-1";
    }
    else{
            sort(a,a+j+1);
        for(i=0;i<=j;i++){
            cout<<a[i];
        }
    }
    }
}