当前位置:网站首页>【暑期每日一题】洛谷 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;
} 边栏推荐
- MySQL 使用客户端以及SELECT 方式查看 BLOB 类型字段内容总结
- 作业7.28 文件IO与标准IO
- 一篇长文---深入理解synchronized
- 亚马逊云助手小程序来啦!
- cdc source能读完MySqlSnapshotSplit 就退出嘛
- Win11vmware turns on the virtual machine and restarts on the blue screen and the solution that cannot be started
- logback 中FileAppender具有什么功能呢?
- 同步/异步、阻塞/非阻塞 与 IO
- Section 7 - compilation of programs (preprocessing operations) + links
- Scala higher order (IX): pattern matching in Scala
猜你喜欢

2022-07-28: what is the output of the following go language code? A:AA; B:AB; C:BA; D:BB。 package main import ( “fmt“ ) func main() { f

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

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

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

MySQL - multi table query

Excel file reading and writing (creation and parsing)

以太网接口介绍

Ansible中的变量及加密

js中break与continue和return关键字
Scala 高阶(九):Scala中的模式匹配
随机推荐
Summary of OCR optical character recognition methods
MySQL 使用客户端以及SELECT 方式查看 BLOB 类型字段内容总结
Job 7.28 file IO and standard IO
Thoroughly understand kubernetes scheduling framework and plug-ins
Female graduate students do "mind mapping" and quarrel with their boyfriend! Netizen: the "king of infighting" in the quarrel
用户列表 圆形头像并跟随小板块
对Vintage分析的一些学习理解
Fillder use
QT基础第二天(2)qt基础部件:按钮类,布局类,输出类,输入类,容器等个别举例
Scala 高阶(九):Scala中的模式匹配
MySQL advanced (Advanced) SQL statement (I)
Thinkphp6 realizes database backup
Operator3-设计一个operator
Some learning and understanding of vintage analysis
logback中RollingFileAppender属性简介说明
Use vscode to configure Mysql to realize connection, query, and other functions
MySQL如何把行转换为列?
How to use GS_ Expansion expansion node
Description of rollingfileappender attribute in logback
0 9 布隆过滤器(Bloom Filter)