Olesya and Rodion(模拟)

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 ≤ 1002 ≤ 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
 
   
思路:
  一开始根本不知道题目说什么,一直都不会做。结果在临近比赛结束时,看到了多组答案,所以突然灵光一闪,是不是要n位且能被t整除的数,而且n是一个100位的,所以我就试一下。结果就是题目这个意思。英语差,不想说话了。(看懂题目就是水题一道)
 
   
AC代码:
 
   
#include<iostream>
#include<algorithm>
#include<cstring>
#include<vector>
#include<cstdio>
#include<map>
using namespace std;
#define CRL(a) memset(a,0,sizeof(a))
typedef __int64 ll;
#define T 1005
int main(){
    /*freopen("input.txt","r",stdin);*/
	int n,m,i,j,k,t;
	while(~scanf("%d%d",&n,&m))
	{
		j=n-1;k=1;
		if(n==1&&m==10)
			printf("-1\n");
		else if(m==10){
			printf("1");
			while(j--)
			{
				printf("0");
			}
			printf("\n");
		}
		else
		{
			while(n--){
			  printf("%d",m);
			}
			printf("\n");
		}
	}
	return 0;
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值