Codeforces Round #324 (Div. 2) A

A. Olesya and Rodion
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Olesya loves numbers consisting of n digits, and Rodion only likes numbers that are divisible by t. Find some number that satisfies both of them.

Your task is: given the n and t print an integer strictly larger than zero consisting of n digits that is divisible by t. If such number doesn't exist, print  - 1.

Input

The single line contains two numbers, n and t (1 ≤ n ≤ 100, 2 ≤ t ≤ 10) — the length of the number and the number it should be divisible by.

Output

Print one such positive number without leading zeroes, — the answer to the problem, or  - 1, if such number doesn't exist. If there are multiple possible answers, you are allowed to print any of them.

Examples
Input
3 2
Output
712

题意; 输出一个数 长度为n并且为t的倍数 不存在 则输出-1

题解: n个t 组成的数一定是t的倍数
考虑特殊 t=10的情况 (水)

 1 #include<iostream>
 2 #include<cstring>
 3 #include<cstdio>
 4 #include<queue>
 5 #include<stack>
 6 #include<cmath>
 7 #define ll __int64 
 8 #define pi acos(-1.0)
 9 #define mod 1000000007
10 using namespace std;
11 int n,t;
12 int main()
13 {
14     scanf("%d %d",&n,&t);
15     if(t<10)
16     {
17         for(int i=1;i<=n;i++)
18             printf("%d",t);
19             cout<<endl;
20     }
21     if(t==10)
22     {
23         if(n==1)
24         cout<<"-1"<<endl;
25         else
26         {
27             for(int i=1;i<n;i++)
28             printf("1",t);    
29              cout<<"0"<<endl;
30         }
31     }
32     return 0;
33  } 
原文地址:https://www.cnblogs.com/hsd-/p/5550821.html