当前位置:网站首页>【暑期每日一题】洛谷 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;
} 边栏推荐
- Synchronous / asynchronous, blocking / non blocking and IO
- WPF simple login page completion case
- 反射reflect
- Clock tree synthesis (I)
- JS chicken laying eggs and egg laying chickens. Who appeared earlier, object or function? Is function an instance of function?
- do end用法的妙处
- Some learning and understanding of vintage analysis
- I, 28, a tester, was ruthlessly dismissed in October: I want to remind people who are still learning to test
- js第四天流程控制(if语句和switch语句)
- Operator3 - design an operator
猜你喜欢

论文阅读 (62):Pointer Networks

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

Comparison of advantages between can & canfd integrated test analysis software lkmaster and PCA Explorer 6 analysis software

halcon的安装以及在vs2017中测试,vs2017中dll的配置

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

JS break and continue and return keywords

Leetcode 879. profit plan

作业7.28 文件IO与标准IO

My personal website doesn't allow access to wechat, so I did this

Summary of OCR optical character recognition methods
随机推荐
logback中RollingFileAppender属性简介说明
Does Flink support sqlserver databases? Get the changes of SQLSERVER database
Gin Middleware
Nodejs安装教程
女研究生做“思维导图”与男友吵架!网友:吵架届的“内卷之王”....
LevelFilter简介说明
使用自定义注解校验list的大小
Use vscode to configure Mysql to realize connection, query, and other functions
【OpenGL】着色器(Shader)的使用
Thinkphp6 realizes database backup
mysql 单表最多能存多少数据?
Explanation of suffix automata (SAM) + Luogu p3804 [template] suffix automata (SAM)
Meta configuration item of route
Scala higher order (IX): pattern matching in Scala
logback日志级别简介说明
2-unified return class dto object
Leetcode 209. subarray with the smallest length (2022.07.28)
Description of rollingfileappender attribute in logback
Reflect reflect
After three years of outsourcing, the salary of automatic testing after job hopping is twice that of the original. The secret is