Codeforce 584A - Olesya and Rodion
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
#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 ;
}
Codeforce 584A - Olesya and Rodion的更多相关文章
- 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 ...
- Olesya and Rodion (思维)
Olesya loves numbers consisting of n digits, and Rodion only likes numbers that are divisible by t. ...
- Codeforces Round #324 (Div. 2) Olesya and Rodion 构造
原题链接:http://codeforces.com/contest/584/problem/A 题意: 给你n和t,让你构造一个长度为n的数,并且被t整除 题解: 方法很多,可以乱构造.....不过 ...
- Codeforces Round #324 (Div. 2)解题报告
---恢复内容开始--- Codeforces Round #324 (Div. 2) Problem A 题目大意:给二个数n.t,求一个n位数能够被t整除,存在多组解时输出任意一组,不存在时输出“ ...
- Codeforces 584 - A/B/C/D/E - (Done)
链接:https://codeforces.com/contest/584 A - Olesya and Rodion - [水] 题解:注意到 $t$ 的范围是 $[2,10]$,对于位数小于 $2 ...
- Codeforces Round #324 (Div. 2) A
A. Olesya and Rodion time limit per test 1 second memory limit per test 256 megabytes input standard ...
- Codeforces Round #324 (Div. 2)
CF的rating设置改了..人太多了,决定开小号打,果然是明智的选择! 水 A - Olesya and Rodion #include <bits/stdc++.h> using na ...
- Codeforce - Street Lamps
Bahosain is walking in a street of N blocks. Each block is either empty or has one lamp. If there is ...
- Codeforce Round #216 Div2
e,还是写一下这次的codeforce吧...庆祝这个月的开始,看自己有能,b到什么样! cf的第二题,脑抽的交了错两次后过了pretest然后system的挂了..脑子里还有自己要挂的感觉,果然回头 ...
随机推荐
- Linux内存管理解析(二) : 关于Linux内存管理的大体框架
什么是内存管理 ? 首先内存管理管理的主要对象是虚拟内存,但是虚拟内存对应的映射主要为物理内存,其次也可能通过交换空间把虚拟内存与硬盘映射起来,既然如此,那我们先了解物理内存的管理. 对于物理内存而言 ...
- java设计模式4——原型模式
java设计模式4--原型模式 1.写在前面 本节内容与C++语言的复制构造函数.浅拷贝.深拷贝极为相似,因此建议学习者可以先了解C++的该部分的相关知识,或者学习完本节内容后,也去了解C++的相应内 ...
- Electron – 基础学习(3): 项目打包成exe桌面应用 之electron-builder
前次用 electron-packager 打包成功,这次改用 electron-builder 打包,然后根据项目中实际需要进行选择使用. 第一步:全局安装 electron-builder,便于系 ...
- AndroidStudio跑起来第一个App时新手遇到的那些坑
场景 当你看了一个Android教程,满心欢喜想要运行第一个HelloWorld时却发现,Android Studio新建的工程老是报错. 会编译不通过.运行按钮灰色.没有虚拟机,一个简简单单的Hel ...
- Git 工作流程和Git分支管理策略
git-flow 阮一峰大佬写的文章真不错 git-flow, github-flow, gitlab-flow 阮一峰大佬写的文章真不错
- 在ServletFilter层返回多字段提示给前端
0.背景:在由于不想在小项目中引入SpringSecurity这种重量级安全框架,我自定义了一个LoginFilter来处理认证+授权逻辑.对于认证或授权失败的情况,最初是在filter中抛出异常,并 ...
- yarn-site.xml 配置介绍
yarn-site.xml 配置介绍 yarn.scheduler.minimum-allocation-mb yarn.scheduler.maximum-allocation-mb 说明:单个容器 ...
- setter&getter
let _age = 4 class Animal { construct (type){ this.type = type } get age(){ return _age } set age(va ...
- ConcurrentHashMap的size()方法(1.7和1.8)
在1.7和1.8版本中,计算size()方法有写不同.先介绍1.7版本的实现. 1.7版本 在1.7版本中,有一个重要的类Segment,利用它来实现分段锁 static final class Se ...
- jQuery---each方法
each方法 each方法 //each方法 $("li").each(function (index, element) { $(element).css("opaci ...