当前位置:网站首页>【暑期每日一题】洛谷 P4414 [COCI2006-2007#2] ABC
【暑期每日一题】洛谷 P4414 [COCI2006-2007#2] ABC
2022-07-29 07:08:00 【AC_Dragon】
题目链接:P4414 [COCI2006-2007#2] ABC - 洛谷 | 计算机科学教育新生态 (luogu.com.cn)
题面翻译
【题目描述】
三个整数分别为 A,B,C。这三个数字不会按照这样的顺序给你,但它们始终满足条件:A < B < C。为了看起来更加简洁明了,我们希望你可以按照给定的顺序重新排列它们。
【输入格式】
第一行包含三个正整数 A,B,C,不一定是按这个顺序。这三个数字都小于或等于 100。第二行包含三个大写字母 A、B 和 C(它们之间没有空格)表示所需的顺序。
【输出格式】
在一行中输出 A,B 和 C,用一个 (空格)隔开。
感谢 @smartzzh 提供的翻译
题目描述
You will be given three integers A, B and C. The numbers will not be given in that exact order, but we do know that A is less than B and B less than C.
In order to make for a more pleasant viewing, we want to rearrange them in the given order.
输入格式
The first line contains three positive integers A, B and C, not necessarily in that order. All three numbers will be less than or equal to 100.
The second line contains three uppercase letters 'A', 'B' and 'C' (with no spaces between them) representing the desired order.
输出格式
Output the A, B and C in the desired order on a single line, separated by single spaces.
样例 #1
样例输入 #1
1 5 3
ABC样例输出 #1
1 3 5样例 #2
样例输入 #2
6 4 2
CAB样例输出 #2
6 2 4AC code:
#include<iostream>
#include<algorithm>
using namespace std;
int n[3];
int main()
{
cin>>n[0]>>n[1]>>n[2];
sort(n,n+3);
int a=n[0];
int b=n[1];
int c=n[2];
string s;
cin>>s;
for(auto i:s)
{
if(i=='A')
cout<<n[0]<<" ";
if(i=='B')
cout<<n[1]<<" ";
if(i=='C')
cout<<n[2]<<" ";
}
return 0;
} 边栏推荐
- QT topic: basic components (button class, layout class, output class, input class, container class)
- Operator3 - design an operator
- logback appender简介说明
- 7-2 calculate the area and perimeter of a regular pentagon (25 points)
- Win11 system error: code execution cannot continue because ierutil.dll cannot be found. Reinstalling the program may fix this problem
- halcon的安装以及在vs2017中测试,vs2017中dll的配置
- How to establish EDI connection with Scania in Scania?
- What is the function of fileappender in logback?
- Summer summary (II)
- logback 中FileAppender具有什么功能呢?
猜你喜欢

Cvpr2021 | multi view stereo matching based on self supervised learning (cvpr2021)

如何与斯堪尼亚SCANIA建立EDI连接?

Ansible中的变量及加密

女研究生做“思维导图”与男友吵架!网友:吵架届的“内卷之王”....

How does MySQL convert rows to columns?

一篇长文---深入理解synchronized

Practice of online problem feedback module (XVII): realize the online download function of excel template

Thoroughly understand kubernetes scheduling framework and plug-ins

同步/异步、阻塞/非阻塞 与 IO

Operator3 - design an operator
随机推荐
Amazon cloud assistant applet is coming!
以太网接口介绍
Introduction to logback appender
QT连接两个qslite数据库报错QSqlQuery::exec: database not open
CDC source can quit after reading MySQL snapshot split
SpingBoot整合Quartz框架实现动态定时任务(支持实时增删改查任务)
LevelFilter简介说明
PAT甲级 1146 拓扑顺序
5-整合swagger2
Tp6 use protobuf
logback filter过滤器简介说明
在线问题反馈模块实战(十七):实现excel模板在线下载功能
20-40k | mecarmand 3D vision algorithm / software / Product Manager Recruitment
1-后台项目搭建
3-global exception handling
halcon的安装以及在vs2017中测试,vs2017中dll的配置
cdc source能读完MySqlSnapshotSplit 就退出嘛
When NPM is installed, it is stuck. There are five solutions
MySQL uses the client and select methods to view the summary of blob type fields
Problems encountered in vmware16 installing virtual machines