当前位置:网站首页>【暑期每日一题】洛谷 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;
}边栏推荐
- Can I specify memory parameters in SQL statements?
- 【Unity实战100例】Unity万能答题系统之单选多选判断题全部通用
- Explanation of suffix automata (SAM) + Luogu p3804 [template] suffix automata (SAM)
- route的meta配置项
- 以太网接口介绍
- How does MySQL convert rows to columns?
- 亚马逊云助手小程序来啦!
- Thoroughly understand kubernetes scheduling framework and plug-ins
- 美智光电IPO被终止:年营收9.26亿 何享健为实控人
- MySQL 有这一篇就够(呕心狂敲37k字,只为博君一点赞!!!)
猜你喜欢

MySQL advanced (Advanced) SQL statement (I)

How does MySQL convert rows to columns?

Latest 10 billion quantitative private placement list

Full process flow of CMOS chip manufacturing

Kubernetes (V) -- deploy kubernetes dashboard

1-后台项目搭建

Amazon cloud assistant applet is coming!

JS 鸡生蛋与蛋生鸡问题,Object与Function究竟谁出现的更早?Function算不算Function的实例?

作业7.28 文件IO与标准IO
Scala higher order (IX): pattern matching in Scala
随机推荐
logback日志级别简介说明
Summer summary (II)
对Vintage分析的一些学习理解
JS 鸡生蛋与蛋生鸡问题,Object与Function究竟谁出现的更早?Function算不算Function的实例?
反射reflect
Practice of online problem feedback module (XVII): realize the online download function of excel template
Why does ETL often become ELT or even let?
do end用法的妙处
Unity sends a post request to the golang server for parsing and returning
Using C language to skillfully realize the chess game -- Sanzi chess
Synchronous / asynchronous, blocking / non blocking and IO
route的meta配置项
MySQL uses the client and select methods to view the summary of blob type fields
Logback log level introduction
暑期总结(二)
计算程序运行时间 demo
WPF simple login page completion case
力扣(LeetCode)209. 长度最小的子数组(2022.07.28)
PAT甲级 1154 顶点着色
Homebrew brew update doesn't respond for a long time (or stuck in updating homebrew...)