当前位置:网站首页>【暑期每日一题】洛谷 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;
} 边栏推荐
- Excel file reading and writing (creation and parsing)
- 对Vintage分析的一些学习理解
- Operator3-设计一个operator
- QT专题:基础部件(按钮类,布局类,输出类,输入类,容器类)
- Leetcode buckle classic problem -- 4. Find the median of two positively ordered arrays
- QT基础第二天(2)qt基础部件:按钮类,布局类,输出类,输入类,容器等个别举例
- Summary of OCR optical character recognition methods
- Vite3.0 has been released, can you still roll it (list of new features)
- Nodejs安装教程
- 计算程序运行时间 demo
猜你喜欢

After 4 years of development and 13K, if you want to change to automated testing, can your salary still rise···

QT基础第二天(2)qt基础部件:按钮类,布局类,输出类,输入类,容器等个别举例

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

It's enough for MySQL to have this article (disgusting and crazy typing 37k words, just for Bo Jun's praise!!!)

Vite3.0 has been released, can you still roll it (list of new features)

Variables and encryption in ansible

WPF simple login page completion case

H3C_ Using setting default static routing priority to realize the active and standby function of export dual lines
Scala 高阶(九):Scala中的模式匹配

MySQL uses the client and select methods to view the summary of blob type fields
随机推荐
【WPF】通过动态/静态资源实现语言切换
【OpenGL】着色器(Shader)的使用
一篇长文---深入理解synchronized
QT连接两个qslite数据库报错QSqlQuery::exec: database not open
My personal website doesn't allow access to wechat, so I did this
LevelFilter简介说明
Comparison of advantages between can & canfd integrated test analysis software lkmaster and PCA Explorer 6 analysis software
暑期总结(二)
logback简介及引入方法
Gin Middleware
使用自定义注解校验list的大小
2-unified return class dto object
QT专题:基础部件(按钮类,布局类,输出类,输入类,容器类)
20-40k | mecarmand 3D vision algorithm / software / Product Manager Recruitment
微服务远程调用
Life cycle hooks in routing - activated and deactivated
Summary of OCR optical character recognition methods
Practice of online problem feedback module (XVII): realize the online download function of excel template
彻底搞懂kubernetes调度框架与插件
Error 1045 (28000) access denied for user 'root' @ 'localhost' solution