Codeforces Round #206 (Div. 1)--Vasya and Digital Root 啊啊啊 啊....感觉我的智商为0........

和宿舍的同学看了两个小时愣是没做出来,我们思维太正规了,看过别人的后,瞬间吐血的节奏,埃.......看看别人的思想吧,世界上聪明的人真多,大神的存在呀。

 Vasya and Digital Root
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Vasya has recently found out what a digital root of a number is and he decided to share his knowledge with you.

Let's assume that S(n) is the sum of digits of number n, for example, S(4098) = 4 + 0 + 9 + 8 = 21. Then the digital root of number nequals to:

  1. dr(n) = S(n), if S(n) < 10;
  2. dr(n) = dr( S(n) ), if S(n) ≥ 10.

For example, dr(4098)  =  dr(21)  =  3.

Vasya is afraid of large numbers, so the numbers he works with are at most 101000. For all such numbers, he has proved that dr(n)  =  S( S( S( S(n) ) ) ) (n ≤ 101000).

Now Vasya wants to quickly find numbers with the given digital root. The problem is, he hasn't learned how to do that and he asked you to help him. You task is, given numbers k and d, find the number consisting of exactly k digits (the leading zeroes are not allowed), with digital root equal to d, or else state that such number does not exist.

Input

The first line contains two integers k and d (1 ≤ k ≤ 1000; 0 ≤ d ≤ 9).

Output

In a single line print either any number that meets the requirements (without the leading zeroes) or "No solution" (without the quotes), if the corresponding number does not exist.

The chosen number must consist of exactly k digits. We assume that number 0 doesn't contain any leading zeroes.

Sample test(s)
input
4 4
output
5881
input
5 1
output
36172
input
1 0
output
0
Note

For the first test sample dr(5881)  =  dr(22)  =  4.

For the second test sample dr(36172)  =  dr(19)  =  dr(10)  =  1.

********这是看过别人的后(在看之前可以先自己做做,一定会感叹的)自己写的代码,已经通**************************************************************

#include
int main()
{
int k,d,i;
scanf("%d%d",&k,&d);
if (d == 0) {
if (k == 1)
printf ("0");
else
printf ("No solution");}
else{
 printf("%d",d);
 for(i=0;i   printf("0");
}
return 0;



你可能感兴趣的:(数学题,C语言,源代码,ACM,codeforces)