ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 1014. Произведение цифр

why i got wrong ?help help help
Послано jinzita 15 июл 2003 14:08
#include <iostream>
using namespace std;


int main()
{
    int se[8]={2,3,4,5,6,7,8,9};
    int ss[8]={0,0,0,0,0,0,0,0};
    int n,t=0,s;
    int i;
    int flag=0;
    int flag2=0;
    cin >> n;


    if(n==0)
        cout << 10 ;
    else
    {
        if(n < 10)
        {
            cout << n;
        }
        else
        {
            for(i=9;(n-i)!=0&&i!=1;i--)
            {
                while(n%i==0)
                {
                    flag=1;
                    t++;
                    n/=i;
                }
                ss[9-i]=t;
                t=0;
            }


            if(flag == 0 || n >=10)
            {
                n=-1;
                cout << n ;
                return 0;
            }
            flag2=i;
            ss[9-i]=1;
    //        cout << flag << endl;
    //        cout << flag << endl;




            for(i=7;i>=0;i--)
            {
                if(se[i]==flag2)
                {
                    s=flag2+s*10;
                    break;
                }

                for(int j=0;j<ss[7-i];j++)
                    s=se[i]+s*10;
            }


            n=0;

            while(s>10)
            {
                n=n*10+s%10;
                s/=10;
            }
            n=n*10+s;
            cout << n;
        }
    }
    return 0;
}
Re: why i got wrong ?help help help
Послано GodZilla 16 июл 2003 04:35
This is a very simple problem.


Hint for you.




Every 3 (2) -> 8


Every 2 (3) -> 9


Every 1 (5) -> 5


Every 1 (7) -> 7




At the last you can get (2(3)and 1(2))or(2(2)and 1 (3)).


Think about this yourself.




I hope this hint helps you.




If you still don't understand mail me VRomanchik@tit.by and


i send to you my AC.




Yours GodZilla
Re: why i got wrong ?help help help
Послано GodZilla 16 июл 2003 04:36
This is a very simple problem.


Hint for you.




Every 3 (2) -> 8


Every 2 (3) -> 9


Every 1 (5) -> 5


Every 1 (7) -> 7




At the last you can get (2(3)and 1(2))or(2(2)and 1 (3)).


Think about this yourself.




I hope this hint helps you.




And one hint more if the number is 0 you should print 10.




If you still don't understand mail me VRomanchik@tit.by and


i send to you my AC.




Yours GodZilla
Look inside previous message
Послано GodZilla 16 июл 2003 04:37
Look inside previous message