链接:

https://codeforces.com/contest/1247/problem/A

题意:

Kolya is very absent-minded. Today his math teacher asked him to solve a simple problem with the equation a+1=b with positive integers a and b, but Kolya forgot the numbers a and b. He does, however, remember that the first (leftmost) digit of a was da, and the first (leftmost) digit of b was db.

Can you reconstruct any equation a+1=b that satisfies this property? It may be possible that Kolya misremembers the digits, and there is no suitable equation, in which case report so.

思路:

特判9 1,其他的照着搞。

代码:

//#include <iostream>
//#include <fstream>
//#include <process.h>
//#include "ch08/ch08Func.cpp"
#include <bits/stdc++.h>
typedef long long LL;
using namespace std; int main()
{
ios::sync_with_stdio(false);
int a, b;
cin >> a >> b;
if (a == b)
{
cout << a << '1' << ' ' << b << '2' << endl;
return 0;
}
if (a == 9 && b == 1)
{
cout << 9 << ' ' << 10 << endl;
return 0;
}
if (a > b || b-a > 1)
{
cout << -1 << endl;
return 0;
}
cout << a << '9' << ' ' << b << '0' << endl; return 0;
}

Codeforces Round #596 (Div. 2, based on Technocup 2020 Elimination Round 2) A. Forgetting Things的更多相关文章

  1. Codeforces Round #596 (Div. 2, based on Technocup 2020 Elimination Round 2)

    A - Forgetting Things 题意:给 \(a,b\) 两个数字的开头数字(1~9),求使得等式 \(a=b-1\) 成立的一组 \(a,b\) ,无解输出-1. 题解:很显然只有 \( ...

  2. Codeforces Round #596 (Div. 2, based on Technocup 2020 Elimination Round 2) D. Power Products

    链接: https://codeforces.com/contest/1247/problem/D 题意: You are given n positive integers a1,-,an, and ...

  3. Codeforces Round #596 (Div. 2, based on Technocup 2020 Elimination Round 2) C. p-binary

    链接: https://codeforces.com/contest/1247/problem/C 题意: Vasya will fancy any number as long as it is a ...

  4. Codeforces Round #596 (Div. 2, based on Technocup 2020 Elimination Round 2) B2. TV Subscriptions (Hard Version)

    链接: https://codeforces.com/contest/1247/problem/B2 题意: The only difference between easy and hard ver ...

  5. Codeforces Round #596 (Div. 2, based on Technocup 2020 Elimination Round 2) F. Tree Factory 构造题

    F. Tree Factory Bytelandian Tree Factory produces trees for all kinds of industrial applications. Yo ...

  6. Codeforces Round #596 (Div. 2, based on Technocup 2020 Elimination Round 2) E. Rock Is Push dp

    E. Rock Is Push You are at the top left cell (1,1) of an n×m labyrinth. Your goal is to get to the b ...

  7. Codeforces Round #596 (Div. 2, based on Technocup 2020 Elimination Round 2) B. TV Subscriptions 尺取法

    B2. TV Subscriptions (Hard Version) The only difference between easy and hard versions is constraint ...

  8. Codeforces Round #596 (Div. 2, based on Technocup 2020 Elimination Round 2) A. Forgetting Things 水题

    A. Forgetting Things Kolya is very absent-minded. Today his math teacher asked him to solve a simple ...

  9. Codeforces Round #596 (Div. 2, based on Technocup 2020 Elimination Round 2) D. Power Products 数学 暴力

    D. Power Products You are given n positive integers a1,-,an, and an integer k≥2. Count the number of ...

随机推荐

  1. Android MTK6580 客制化关机充电动画

    1.客制化关机充电图片 vendor/mediatek/proprietary/bootable/bootloader/lk/dev/logo/xxx 找到对应分辨率替换 2.调整显示图片位置.大小 ...

  2. Jmeter plugins 之 Perfmon Metrics Collector(服务器性能监控)

    客户端(Jmeter端) 1.安装plugins manager,然后安装  2.添加listener-(第1步成功后才可看到此功能)  服务端:(要监控的服务器) 1.下载ServerAgent,并 ...

  3. java日志框架系列(6):logback框架encoder详解

    1.Encoder 1.encoder功能 Encoder 负责两件事,一是把事件转换为字节数组,二是把字节数组写入输出流. 注意:在logback 0.9.19 版之前没有 encoder. 在之前 ...

  4. Oracle10G安装手册

    环境准备: 操作系统:windows-7 32bit 数据库:oracle10G 网络环境:不能使用DHCP模式,必须设置一个固定IP地址. 运行安装 1.打开oracle安装文件,请勿直接选择set ...

  5. 解析spring启动加载dubbo过程

    一:简单配置 web.xml <context-param> <param-name>contextConfigLocation</param-name> < ...

  6. 用c++ sttring检测名字是否有空格

    name.find(' ') == std::string::npos//npos==-1,表示没找到

  7. win10系统ping另一台电脑上虚拟机的IP

    刚刚因为虚拟机与主机没法互相ping通的事情,奋战到将近凌晨一点.现在把这个过程总结一下,以方便后加入该行业的广大IT精英. VMWare提供了三种工作模式:bridged(桥接模式).NAT(网络地 ...

  8. RabbitMq的环境安装

    1.如图第一个是erlang语言的安装包,第二个是rabbitmq的安装包. 2.配置erlang语言环境,因为rabbitmq由erlang语言编写的,所以需要配置erlng语言环境. erlang ...

  9. [jquery]ajax最最常用的七个属性

    1.url 类型:String 默认值: 当前页地址.发送请求的地址. 2.data 类型:String 发送到服务器的数据.将自动转换为请求字符串格式.GET 请求中将附加在 URL 后.查看 pr ...

  10. SQL Server系统函数:日期函数

    原文:SQL Server系统函数:日期函数 1.返回当前日期和时间 select GETDATE() '当前日期-精确到33毫秒' select GETUTCDATE() 'UTC日期和时间-精确到 ...