当前位置:网站首页>【暑期每日一题】洛谷 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;
} 边栏推荐
- My personal website doesn't allow access to wechat, so I did this
- logback 中FileAppender具有什么功能呢?
- Vagrant box cluster processing
- MySQL 有这一篇就够(呕心狂敲37k字,只为博君一点赞!!!)
- Synchronous / asynchronous, blocking / non blocking and IO
- 0 9 布隆过滤器(Bloom Filter)
- Zabbix 其他基础监控项
- Gin service exit
- Fillder use
- Operator3 - design an operator
猜你喜欢

Section 7 - compilation of programs (preprocessing operations) + links

使用自定义注解校验list的大小
Scala 高阶(九):Scala中的模式匹配

Spingboot integrates the quartz framework to realize dynamic scheduled tasks (support real-time addition, deletion, modification and query tasks)

js中break与continue和return关键字

Using C language to skillfully realize the chess game -- Sanzi chess

MySQL如何把行转换为列?

Paper reading (62):pointer networks

MySQL - multi table query

第7节-程序的编译(预处理操作)+链接
随机推荐
WPF interface layout must know basis
Description of rollingfileappender attribute in logback
MySQL uses the client and select methods to view the summary of blob type fields
Vagrant box cluster processing
Practice of online problem feedback module (XVII): realize the online download function of excel template
log4j Layout简介说明
5-整合swagger2
3-全局异常处理
Leetcode 879. profit plan
Levelfilter introduction
计算程序运行时间 demo
Ethernet interface introduction
Round avatar of user list and follow small blocks
do end用法的妙处
How does MySQL convert rows to columns?
thinkphp6 实现数据库备份
Female graduate students do "mind mapping" and quarrel with their boyfriend! Netizen: the "king of infighting" in the quarrel
Kubernetes (V) -- deploy kubernetes dashboard
以太网接口介绍
论文阅读 (62):Pointer Networks