当前位置:网站首页>【暑期每日一题】洛谷 P6500 [COCI2010-2011#3] ZBROJ
【暑期每日一题】洛谷 P6500 [COCI2010-2011#3] ZBROJ
2022-07-29 07:08:00 【AC_Dragon】
题目链接:P6500 [COCI2010-2011#3] ZBROJ - 洛谷 | 计算机科学教育新生态 (luogu.com.cn)
题目描述
老师给了 Perica 两个数 a, b,Perica 将他们抄在了笔记本上,并要算出他们的和。
在抄写过程中,Perica 可能会将 a, b 中的数字 6 错抄成数字 5,也可能将数字 5 错抄成数字 6,当然也可能不抄错。
给定 a, b,请求出 Perica 算出的和最小和最大分别是多少。
输入格式
输入只有一行两个整数,分别表示 a 和 b。
输出格式
输出一行两个整数,表示最小可能的和以及最大可能的和。
样例 #1
样例输入 #1
11 25样例输出 #1
36 37样例 #2
样例输入 #2
1430 4862样例输出 #2
6282 6292样例 #3
样例输入 #3
16796 58786样例输出 #3
74580 85582提示
数据规模与约定
对于全部的测试点,保证 1 <= a, b <= 10^6。
说明
题目译自 COCI2010-2011 CONTEST #3 T2 ZBROJ。
AC code:(注意:i 前面一定要加&!!!)
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
string a,b;
cin>>a>>b;
for(auto &i: a) // i前面一定要加 &
{
if(i=='6')
i='5';
}
for(auto &i:b) // i前面一定要加 &
{
if(i=='6')
i='5';
}
cout<<atol(a.c_str())+atol(b.c_str())<<" ";
for(auto &i: a) // i前面一定要加 &
{
if(i=='5')
i='6';
}
for(auto &i: b) // i前面一定要加 &
{
if(i=='5')
i='6';
}
cout<<atol(a.c_str())+atol(b.c_str());
return 0;
}边栏推荐
- [Charles' daily problems] when you open Charles, you can't use nails
- [redis] redis development specifications and precautions
- 3-global exception handling
- js第四天流程控制(if语句和switch语句)
- How much data can a single MySQL table store at most?
- Introduction to log4j layout
- logback日志级别简介说明
- I'd like to ask, my flick job writes data in the way of upsert Kafka, but I'm more careful in MySQL
- 亚马逊云助手小程序来啦!
- 作业7.28 文件IO与标准IO
猜你喜欢

Thoroughly understand kubernetes scheduling framework and plug-ins

2022-07-28: what is the output of the following go language code? A:AA; B:AB; C:BA; D:BB。 package main import ( “fmt“ ) func main() { f

A long article --- in-depth understanding of synchronized

09 bloom filter

Ethernet interface introduction
![[Charles' daily problems] when you open Charles, you can't use nails](/img/ef/037fc416175d4de769ac6484cb53df.png)
[Charles' daily problems] when you open Charles, you can't use nails

JS break and continue and return keywords

2-统一返回类DTO对象

Variables and encryption in ansible

After 4 years of development and 13K, if you want to change to automated testing, can your salary still rise···
随机推荐
Zabbix 其他基础监控项
5-integrate swagger2
Thinkphp6 realizes database backup
5-整合swagger2
3-全局异常处理
How to use GS_ Expansion expansion node
QT专题:基础部件(按钮类,布局类,输出类,输入类,容器类)
Custom events
BeanUtils.setProperty()
对Vintage分析的一些学习理解
BeanUtils.setProperty()
Paper reading (62):pointer networks
A long article --- in-depth understanding of synchronized
我想问一下,我flink作业是以upsert-kafka的方式写入数据的,但是我在mysql里面去更
mysql 单表最多能存多少数据?
QT basic day 2 (2) QT basic components: button class, layout class, output class, input class, container and other individual examples
Homebrew brew update 长时间没反应(或卡在 Updating Homebrew...)
Comparison of advantages between can & canfd integrated test analysis software lkmaster and PCA Explorer 6 analysis software
NPM install reports an error NPM err could not resolve dependency NPM err peer
I, 28, a tester, was ruthlessly dismissed in October: I want to remind people who are still learning to test