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的挂了..脑子里还有自己要挂的感觉,果然回头 ...
随机推荐
- StackExchange.Redis 之 List队列 类型示例
//从第1个开始,依次向左插入值.如果键不存在,先创建再插入值 队列形式 先进后出,后进先出 //插入后形式 <-- 10,9,8,7,6,5,4,3,2,1 <-- 方向向左依次进行 ...
- git命令小汇总和github
Git 简介 是什么 Git 也是一个版本控制管理软件 有什么用,可以解决什么问题 保存历史记录 多人协作 有了 SVN,为啥要学 Git Git 火 Git 相对于 SVN 来说,更强大,用户也非常 ...
- 源码浅析:MySQL一条insert操作,会写哪些文件?包括UNDO相关的文件吗?
DML操作的大致流程 在解答上述疑惑之前,我们来梳理一下DML操作的大致流程: 1.语法解析.语义解析 2.生成执行计划 3.事务修改阶段 1) 激活事务,事务状态由not_active变为activ ...
- opencv —— moments 矩的计算(空间矩/几何矩、中心距、归一化中心距、Hu矩)
计算矩的目的 从一幅图像计算出来的矩集,不仅可以描述图像形状的全局特征,而且可以提供大量关于该图像不同的几何特征信息,如大小,位置.方向和形状等.这种描述能力广泛应用于各种图像处理.计算机视觉和机器人 ...
- 刷题84. Largest Rectangle in Histogram
一.题目说明 题目84. Largest Rectangle in Histogram,给定n个非负整数(每个柱子宽度为1)形成柱状图,求该图的最大面积.题目难度是Hard! 二.我的解答 这是一个 ...
- 6.python设置代理和添加镜像源介绍
为什么要修改镜像源? 一般使用python安装库,会用到pip install xxx 指令或者conda install xxx指令,因为pip和conda默认国外镜像源,这时会在Python的官方 ...
- Binder 原理整理
linux进程间通信方式 1. 管道 管道的实质是一个内核缓冲区,管道的作用正如其名,需要通信的两个进程在管道的两端,进程利用管道传递信息.管道对于管道两端的进程而言,就是一个文件,但是这个文件比较特 ...
- 《手把手教你构建自己的 Linux 系统》学习笔记(2)
Linux 系统定制原理 虚拟根目录 我们的目标是为了完成目标系统(也就是我们要做的系统),他是一个可以独立运行的系统,不依赖雨主系统和临时系统,根据 Linux 系统的特点它需要存放在根目录下面,但 ...
- 保存为pickle
保存为pickle import pickle # 保存模型 with open('model.pickle', 'wb') as f: pickle.dump(model, f) # 读取模型 wi ...
- 初识Idea,部署Maven项目常见问题解决方案
一.idea 中项目右键没有run命令选项,没有maven的clean与install选项 解决方案:安装Maven Helper插件 二.Idea不识别java文件(类文件显示橙色) 解决方案: 第 ...