Codeforce 584A - Olesya and Rodion
2024-10-08 07:20:33
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
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cstring>
#include <sstream>
using namespace std;
const int maxn = 1e9+;
#define N 10005
int main()
{
int n,t,i;
scanf("%d %d", &n, &t);
if(n==&&t==){
printf("-1\n");
}
else{
if(t==){
t=;
}
printf("%d",t);
for(i=;i<n-; i++) {
printf("");
}
printf("\n");
}
return ;
}
最新文章
- SQL Server-外部联接基础回顾(十三)
- Mybatis总结
- TID大会学习心得之敏捷软件架构-微服务
- JavaScript的陷阱
- 【ios】使用Block对POST异步操作的简单封装
- 扩展服务 修改新增Service的默认主题
- JavaScript中创建字典对象(dictionary)实例
- w3c subscribe
- Android 所有颜色代码
- ASP.NET网站实现中英文转换(本地化资源)
- 微信小程序- 生成二维码
- JDK 中的设计模式应用实例
- MFC中CFileDialog用法
- python之路-----python操作 mysql
- uva1673(后缀自动机)
- BZOJ2843 极地旅行社 LCT
- Redis Cluster集群搭建<;原>;
- ASCII对照表
- 《剑指offer》面试题39 二叉树的深度(java)
- html学习第一讲(内容html常规控件的的使用)