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运维---1.Ceph分布式存储架构及工作原理
Ceph理论 Ceph 简介 Ceph 是一个开源项目,它提供软件定义的.统一的存储解决方案 .Ceph 是一个具有高性能.高度可伸缩性.可大规模扩展并且无单点故障的分布式存储系统 . Ceph 是软 ...
- 用PHP&JS实现的ID&密码校验程序
声明:本程序纯粹是本人在学习过程中突发奇想做的,并未考虑任何可行性,实用性,只是留下来供以后参考. 前端页面 sign.html <!DOCTYPE html> <html> ...
- ModbusTCP协议解析 —— 利用Wireshark对报文逐字节进行解析详细解析Modbus所含功能码
现在网上有很多类似的文章.其实这一篇也借鉴了很多其他博主的文章. 写这篇文章的重点是在于解析功能和报文.对Modbus这个协议并不会做很多介绍. 好了,我们开始吧. 常用的功能码其实也没多少.我也就按 ...
- js文本复制插件&vue
/* HTML: * <a href="javascript:;" class="copy" data-clipboard-text="copy ...
- 04.JS逻辑结构
前言: 学习一门编程语言的基本步骤(01)了解背景知识(02)搭建开发环境(03)语法规范(04)常量和变量(05)数据类型(06)数据类型转换(07)运算符(08)逻辑结构8.逻辑结构——logi ...
- POSIX简介
POSIX:Potable Operating System Interface of UNIX (可移植操作系统接口),是IEEE为要在各种UNIX操作系统上运行软件,而定义API的一系列互相关联的 ...
- mongo shell
mongo shell mongo 连接 本地 mongo # 连接127.0.0.1:27017 远程 mongo "mongodb://mongodb0.example.com:2801 ...
- TotalUninstall6破解步骤卸载软件更彻底更专业
软件包分享,这里使用的是6.24版本 链接:https://pan.baidu.com/s/1aVd6bclk5A6puyWBfAOA2A提取码:mhl9 接下来开始安装 安装步骤: 点击安装.基本上 ...
- opencv —— copyTo 设置与操作感兴趣区域(ROI)
感兴趣区域:ROI 对感兴趣区域进行的一系列操作,相当于直接在原图相应部分进行操作. Mat imageROI = srcImage(Rect(0,0,dstImage.cols, dstImage. ...
- 使用 VMware Workstation Pro 安装新的虚拟机
一.连接服务器 (1)“文件”右键 (2)输入用户名.密码连接服务器 二.创建新的虚拟机 (1) (2) (3) (4) (5) (6) (7) (8) 三.配置服务器 配置文档 - 链接:htt ...