A. Olesya and Rodion

Time Limit: 1 Sec

Memory Limit: 256 MB

题目连接

http://codeforces.com/contest/584/problem/A

Description

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.
 

Sample Input

3 2

Sample Output

712

HINT

题意

让你构造一个数,使得这个数有n位,且mod k==0;

题解:

只有一个情况输出-1,就是10 1的时候

其他情况,就直接在后面加0就好了

比如 3 2

你就输出 300

4 7

你就输出 4000000

代码:

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

Codeforces Round #324 (Div. 2) A. Olesya and Rodion 水题的更多相关文章

  1. Codeforces Round #297 (Div. 2)A. Vitaliy and Pie 水题

    Codeforces Round #297 (Div. 2)A. Vitaliy and Pie Time Limit: 2 Sec  Memory Limit: 256 MBSubmit: xxx  ...

  2. Codeforces Round #290 (Div. 2) A. Fox And Snake 水题

    A. Fox And Snake 题目连接: http://codeforces.com/contest/510/problem/A Description Fox Ciel starts to le ...

  3. Codeforces Round #322 (Div. 2) A. Vasya the Hipster 水题

    A. Vasya the Hipster Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/581/p ...

  4. Codeforces Round #373 (Div. 2) B. Anatoly and Cockroaches 水题

    B. Anatoly and Cockroaches 题目连接: http://codeforces.com/contest/719/problem/B Description Anatoly liv ...

  5. Codeforces Round #368 (Div. 2) A. Brain's Photos 水题

    A. Brain's Photos 题目连接: http://www.codeforces.com/contest/707/problem/A Description Small, but very ...

  6. Codeforces Round #359 (Div. 2) A. Free Ice Cream 水题

    A. Free Ice Cream 题目连接: http://www.codeforces.com/contest/686/problem/A Description After their adve ...

  7. Codeforces Round #355 (Div. 2) A. Vanya and Fence 水题

    A. Vanya and Fence 题目连接: http://www.codeforces.com/contest/677/problem/A Description Vanya and his f ...

  8. Codeforces Round #384 (Div. 2) A. Vladik and flights 水题

    A. Vladik and flights 题目链接 http://codeforces.com/contest/743/problem/A 题面 Vladik is a competitive pr ...

  9. Codeforces Round #379 (Div. 2) D. Anton and Chess 水题

    D. Anton and Chess 题目连接: http://codeforces.com/contest/734/problem/D Description Anton likes to play ...

随机推荐

  1. C++中巧妙的位运算

    位运算要多想到与预算和异或运算,并常常将两个数对应位上相同和不同分开处理 一.x&(x-1)消除x二进制中最右边的一个1. 这个比较厉害,比如统计某个 二.与和异或的巧妙结合的思想 与运算可以 ...

  2. 1210. Kind Spirits(spfa)

    1210 简单模版题 敲个spfa还得瞟下模版.. #include <iostream> #include<cstdio> #include<cstring> # ...

  3. 函数 buf_block_init

    /********************************************************************//** Initializes a buffer contr ...

  4. UVa 673 (括号配对) Parentheses Balance

    本来是当做水题来做的,后来发现这道题略坑. 首先输入的字符串可能是空串,所以我用了gets函数,紧接着就被scanf("%d", &n)后面的换行符坑掉了. 于是乎再加一句 ...

  5. JVM问题定位工具

    JDB JDB是基于文本和命令行的调试工具,Jikes在JDB的基础上提供了GUI.熟悉JDB还是有价值的,很多情况下需要我们在命令行下完成简单的debug问题定位. 1 2 3 jdb -class ...

  6. android listview 使用checkbox问题

    在android中使用listview时需要了解listview加载数据的原理,为了避免listview由于列表项过多每次需要进行new造成性能低下的问题,android中的listview使用了控件 ...

  7. EntityFramework版本下载和更新

    安装指定版本的Package(例如:EntityFramework 5.0): PM> Install-Package EntityFramework -ProjectName MusicSto ...

  8. (四)学习MVC之修改个人资料和身份验证登陆

    1.修改资料不用建立模型,直接在UserControl.cs添加 ChangeInfo(): #region 修改用户资料 [UserAuthorize] public ActionResult Ch ...

  9. jQuery基础知识— 获得内容和属性

    jQuery拥有可操作HTML元素和属性的方法.   获得内容: text()--设置或返回所选元素的文本内容 html()--设置或返回所选元素的内容(包括HTML标记) val()--设置或返回表 ...

  10. 将你的Asp.NET应用程序嵌入到SharePoint

    转:http://www.cnblogs.com/Clank/archive/2007/05/21/754073.html 为什么要将Asp.net应用程序嵌入到SharePoint?这个我们不讨论! ...