ENG  RUS Timus Online Judge
Online Judge
Problems
Authors
Online contests
Site news
Webboard
Problem set
Submit solution
Judge status
Guide
Register
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

## Discussion of Problem 1014. Product of Digits

Test for WA#8
Posted by Xaker MSU_Tashkent 3 Dec 2011 01:54
N=12 Q=26 not 34.
Re: Test for WA#8
Posted by Chornovek 20 Nov 2012 14:51
34 or 26
Re: Test for WA#8
Posted by HengenVaara 24 Nov 2012 23:50
But 26 is less than 34

Edited by author 24.11.2012 23:51
Re: Test for WA#8
Posted by abid1729 24 Jun 2019 00:49
thats my code
shows 26 for 12
but get wa on test 8
#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];
}
}
}
}