Codeforces Round #596 (Div. 2, based on Technocup 2020 Elimination Round 2) A. Forgetting Things
链接:
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的更多相关文章
- 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. 题解:很显然只有 \( ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
随机推荐
- mq 探究
一 mq简介(message queue) 消息队列技术是分布式应用间交互信息的一种技术. 消息队列可驻留在内存或磁盘上,队列存储消息直到它们被应用程序读走 通过消息队列,应用程序可独立地执行-它们不 ...
- Echarts API说明文档
theme = { // 全图默认背景 // backgroundColor: 'rgba(0,0,0,0)', // 默认色板 ...
- go 结构体2 文法
结构体文法表示通过结构体字段的值作为列表来新分配一个结构体. 使用 Name: 语法可以仅列出部分字段.(字段名的顺序无关.) 特殊的前缀 & 返回一个指向结构体的指针. //分配的v1结构体 ...
- diverta 2019 Programming Contest
A:签到. #include<bits/stdc++.h> using namespace std; #define ll long long #define inf 1000000010 ...
- 前端开发 Vue -0前言
Vue2.0 新手完全填坑攻略——从环境搭建到发布 Vue2 入门,读这篇就够了 Jinkey原创感谢 showonne.yubang 技术指导Demo 地址:http://demo.jinkey.i ...
- 配置vue 多页面
安装vue 1. 全局安装 vue-cli环境 npm install --global vue-cli 2. 创建一个基于webpack模板的新项目 vue init webpack my-proj ...
- 十六进制转换十进制(JAVA版)
解题思路路大概为:现将十六进制数转换为二进制数,再讲二进制数转换为八进制数.在进行十六进制转换为八进制时可以利用JAVA中的‘&’运算符号,一个十六进制数可以表示为四个二进制数,利用‘& ...
- IOS 主队列,全局队列的关系
同步,异步,串行,并发 同步和异步代表会不会开辟新的线程.串行和并发代表任务执行的方式. 同步串行和同步并发,任务执行的方式是一样的.没有区别,因为没有开辟新的线程,所有的任务都是在一条线程里面执行. ...
- Django对postgresql数据库进行分组聚合查询
action(methods=['GET'], detail=False, url_path='count') def count(self, request): """ ...
- mongoose整理笔记
一:参考学习网址 npm: https://www.npmjs.com/package/mongoose 官网API:http://mongoosejs.com/docs/guide.html 二:在 ...