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 ofndigits, and Rodion only likes numbers that are divisible byt. Find some number that satisfies both of them.

Your task is: given thenandtprint an integer strictly larger than zero consisting ofndigits that is divisible byt. If such number doesn’t exist, print-1.

Input

The single line contains two numbers,nandt(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.

Sample test(s)

input

3 2

output

712

解题说明:此题要求一个能被t整除的n位数,可以采用构造的方法,最容易想到的数字是以t为开始,后面全部为0. 当然,需要排除位数为1但t=10的情况。

#include<stdio.h>#include <string.h>#include<iostream>#include<algorithm>using namespace std;int main(){int n, t, i;scanf("%d %d", &n, &t);if(n==1 && t==10) {printf("-1\n");}else{if(t==10) {t=1;}printf("%d", t);for(i=0; i<n-1; i++){printf("0");}printf("\n");}return 0;}

版权声明:本文为博主原创文章,,未经博主允许不得转载。

获致幸福的不二法门是珍视你所拥有的遗忘你所没有的。

A. Olesya and Rodion

相关文章:

你感兴趣的文章:

标签云: