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

What wrong in my problem. Its giving correct answer for me but if fails test#1 itself.
Posted by Karthick P 27 Jan 2006 20:12
#include<stdio.h>

int main()
{
    long input;
    int output[100];
    int i,j=0;
    scanf("%ld",&input);
    if (input<10)
    {
        printf("1%d",input);
        return 1;
    }
    while (input>9)
    {
        for(i=9;i>1;i--)
        {
            if(input%i == 0)
            {
                output[j]=i;
                printf("%d\n",i);
                j++;
                input/=i;
                break;
            }
        }
        if(i==1)
        {
            printf("-1");
            return 1;
        }
    }
    output[j]=input;
    for(i=j;i>=0;i--)
    {
        printf("%d",output[i]);
    }
    return 1;
}
Re: What wrong in my problem. Its giving correct answer for me but if fails test#1 itself.
Posted by Burunduk1 27 Jan 2006 20:39
Test:
51
Right answer:
-1

Test:
6
Right answer:
6
Re: What wrong in my problem. Its giving correct answer for me but if fails test#1 itself.
Posted by flydream 31 Aug 2006 21:06
your output format is wrong
commentary //printf("%d\n",i);