Ուղարկել | Բոլոր լուծումները | Լավագույն լուծումները | Վերադառնալ ցուցակին |
ACM_0174 - DRAGONS QUESTION |
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.
Input
The input file contains the only line with numbers n and d (1 ≤ n ≤ 1000; 1 ≤ d ≤ 1 000 000).
Output
The first and only line of the output file must contain the answer to be given to the dragon — either a n-d igit number (without leading zeroes) divisible by d or a string “No solution”.
Example
N |
stdin |
stdout |
1 |
20 1 |
10000000000000000000 |
2 |
1 23 |
No solution |
3 |
1 4 |
4 |
Ավելացրեց. | Հրանտ Հովհաննիսյան |
Ամսաթիվ. | 2014-04-09 |
Ժամանակի սահմանափակումը. | 1s |
Ծրագրի տեքստի սահմանափակումը. | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Լեզուներ. | ASM32-GCC MAWK BC C-CLANG NCSHARP CPP14 CPP14-CLANG COBOL COFFEE D-CLANG D-DMD DART ELIXIR FANTOM FORTH GRV JS-MONKEY JULIA KTLN OBJC OCT PROLOG R RACKET SQLITE SWIFT UNLAMBDA VB.NET |
Աղբյուրը. | Northern QF 2009.D |