Codeforce 584A - Olesya and Rodion
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
1 #include <iostream> 2 #include <stdio.h> 3 #include <algorithm> 4 #include <cstring> 5 #include <sstream> 6 using namespace std; 7 const int maxn = 1e9+10; 8 #define N 10005 9 int main() 10 { 11 int n,t,i; 12 scanf("%d %d", &n, &t); 13 if(n==1&&t==10){ 14 printf("-1\n"); 15 } 16 else{ 17 if(t==10){ 18 t=1; 19 } 20 printf("%d",t); 21 for(i=0;i<n-1; i++) { 22 printf("0"); 23 } 24 printf("\n"); 25 } 26 return 0; 27 }