Выбрать соревнование | Задачи | Послать решение | Результаты проверки | Статистика по задачам | Вопросы и ответы | Результаты соревнования | Состояние сервера | Изменить данные | Управление командой | Помощь |

Элементы теории чисел, диофантовы уравнения

Олимпиадные задачи на английском языке

Олимпиадные задачи на английском языке

03/11/2009 | Тренировка (задачи Северного четвертьфинала 2009) (D) |

17/07/2020 | Летние сборы - 9 (командное) (D) |

*Ограничения: время – 3s/6s, память – 256MiB Ввод: input.txt или стандартный ввод Вывод: output.txt или стандартный вывод*

Послать решение Blockly Посылки Темы Где Обсудить (0)

In a land far-away there lives a noble man, and he has three sons.
The elder of them is
very clever, his especial strength is calculation:
he can easily count a determinant of fifth degree
in his mind without paper and pencil.
The middle brother is also very talented, he is particularly strong
in theoretic questions.
But the younger brother has absolutely no talent in mathematics.

One day they went for a walk. Suddenly a wind started to blow and
something closed the sun from them: it was a hungry dragon, returning to
his lair from unsuccessful hunt.

"Hey, boys. I will give you a problem, and if you do not solve it,
nothing will save you!" – said the dragon.

The elder brothers smiled ironically. Of course, they were so clever that no
dragon could ask them a question they were not able to answer.

"Give me a positive integer number which is
divisible by `d` and has exactly `n` digits in it, assuming that
`d` is equal to forty-five and `n` is equal to three!" – was the dragon's question.

"One hundred and thirty-five." – answered the elder brother.

"Good, go where you want. But I will return and ask you a similar question
in a year." – said the upset hungry dragon and flew away.

A year passed, and the elder brother got married and left his parents' home.
Two younger brothers went for a walk discussing this event, and
met the dragon again.

"Hey boys, give me a positive integer number
which is divisible by twenty three and has exactly one digit in it" – asked the dragon.

"No solution" – answered the middle brother.

"You are still too clever, go where you want. But I will return and ask
you a similar question." – said the dragon and flew away.

Another year passed and the middle brother got married and left his parents'
home.
The younger brother now does not go outside, because he does not have enough
knowledge to answer the dragon's questions.
Please, help him and write a program – the boy is very afraid.

The input file contains the only line with numbers `n` and `d`
(`1\ ≤\ n\ ≤\ 1000`; `1\ ≤\ d\ ≤\ 1\ 000\ 000`).

The first and only line of the output file must contain the answer to be
given to the dragon – either a `n`-digit number (without leading zeroes)
divisible by `d` or a string "`No solution`".

Sample Input 1

20 1

Sample Output 1

10000000000000000000

Sample Input 2

1 23

Sample Output 2

No solution

Sample Input 3

1 4

Sample Output 3

4