Codeforces Round #324 (Div. 2) A
1 second
256 megabytes
standard input
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.
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.
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.
3 2
712 题意; 输出一个数 长度为n并且为t的倍数 不存在 则输出-1 题解: n个t 组成的数一定是t的倍数
考虑特殊 t=10的情况 (水)
#include<iostream>
#include<cstring>
#include<cstdio>
#include<queue>
#include<stack>
#include<cmath>
#define ll __int64
#define pi acos(-1.0)
#define mod 1000000007
using namespace std;
int n,t;
int main()
{
scanf("%d %d",&n,&t);
if(t<)
{
for(int i=;i<=n;i++)
printf("%d",t);
cout<<endl;
}
if(t==)
{
if(n==)
cout<<"-1"<<endl;
else
{
for(int i=;i<n;i++)
printf("",t);
cout<<""<<endl;
}
}
return ;
}
Codeforces Round #324 (Div. 2) A的更多相关文章
- Codeforces Round #324 (Div. 2)解题报告
---恢复内容开始--- Codeforces Round #324 (Div. 2) Problem A 题目大意:给二个数n.t,求一个n位数能够被t整除,存在多组解时输出任意一组,不存在时输出“ ...
- Codeforces Round #324 (Div. 2) C (二分)
题目链接:http://codeforces.com/contest/734/problem/C 题意: 玩一个游戏,一开始升一级需要t秒时间,现在有a, b两种魔法,两种魔法分别有m1, m2种效果 ...
- Codeforces Round #324 (Div. 2) E. Anton and Ira 贪心
E. Anton and Ira Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/584/probl ...
- Codeforces Round #324 (Div. 2) D. Dima and Lisa 哥德巴赫猜想
D. Dima and Lisa Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/584/probl ...
- Codeforces Round #324 (Div. 2) C. Marina and Vasya 贪心
C. Marina and Vasya Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/584/pr ...
- Codeforces Round #324 (Div. 2) B. Kolya and Tanya 快速幂
B. Kolya and Tanya Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/584/pro ...
- Codeforces Round #324 (Div. 2) A. Olesya and Rodion 水题
A. Olesya and Rodion Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/584/p ...
- Codeforces Round #324 (Div. 2) (哥德巴赫猜想)
题目:http://codeforces.com/problemset/problem/584/D 思路: 关于偶数的哥德巴赫猜想:任一大于2的偶数都可写成两个素数之和. 关于奇数的哥德巴赫猜想:任一 ...
- Codeforces Round #324 (Div. 2) Dima and Lisa 哥德巴赫猜想
原题链接:http://codeforces.com/contest/584/problem/D 题意: 给你一个奇数,让你寻找三个以内素数,使得和为这个奇数. 题解: 这题嘛...瞎比搞搞就好,首先 ...
- Codeforces Round #324 (Div. 2) Marina and Vasya 乱搞推理
原题链接:http://codeforces.com/contest/584/problem/C 题意: 定义$f(s1,s2)$为$s1,s2$不同的字母的个数.现在让你构造一个串$s3$,使得$f ...
随机推荐
- Eclipse搭建SpringBoot
第一种方法(不建议) 首先新建Maven工程 勾选第一个按钮,第三个是选择working set ,你可以不选 下一步,配置工程信息,注意打包为jar 打开pom.xml文件,添加spring-boo ...
- HTML常用标签用法及实例
HTML常用标签用法及实例1.<!--1.注释-->2.<!--2.DOCTPYE 声明文档类型-->3.<!--3.a--> <a href="h ...
- DrawGrid 做图片显示 代码简单 参考性强 (Delphi7)
运行效果图 源码 http://files.cnblogs.com/lwm8246/DrawGrid_demo.rar procedure TfrmMain.GridDrawCell(Send ...
- 存在チェックのみする場合はcount(*)でOK
SELECT SINGLE COUNT(*) FROM T001 WHERE BUKRS = P_BUKRS. IF SY-SUBRC <> 0. ENDIF.
- NodeJS解析客户端请求的body中的内容
request.body undefinded 解决方法 app.use(bodyParser.json({extended: false}));app.use(bodyParser.urlencod ...
- JS中调用android和ios系统手机打开相机并可选择相册功能
编写不易,如有转载,请声明出处: 梦回河口:http://blog.csdn.net/zxc514257857/article/details/57626154 实现android手机打开相机选择相册 ...
- 关于Python、Java、C#语言的一些比较
不能说某某语言不好! 首先,千万别说某一个语言好不好,应为这样的用词是错的,我曾经在好多场合听到一些程序员说java好,.net不好这类的话. 其实语言不分好坏,只是在具体的某些领域或业务场景上不合适 ...
- 剑指Offer - 九度1214 - 丑数
剑指Offer - 九度1214 - 丑数2013-11-21 21:06 题目描述: 把只包含因子2.3和5的数称作丑数(Ugly Number).例如6.8都是丑数,但14不是,因为它包含因子7. ...
- PHP字符串word末字符大小写互换
要求 给出一个字符串如 “A journey of, a thousand 'miles' must can't \"begin\" with a single step.” ,通 ...
- java中多态的概念
概念: 简答来说,多态(Polymorphism)是具有表现多种形态的能力的特征. 更专业的说法是:同一个实现接口,使用不同的实例而执行不同的操作. 好处: 通过多态可以减少类中代码量,可以提高 ...