首页 > 其他分享 >P4414 [COCI2006-2007#2] ABC

P4414 [COCI2006-2007#2] ABC

时间:2023-06-22 15:44:22浏览次数:33  
标签:ABC less COCI2006 样例 three P4414 order

[COCI2006-2007#2] ABC

题面翻译

【题目描述】

三个整数分别为 $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 4

代码

#include<bits/stdc++.h>
using namespace std;
int a[3];
char str[3];
int main()
{
    for(int i=0;i<3;i++)scanf("%d",&a[i]);
    sort(a,a+3);
    for(int i=0;i<3;i++)scanf("%s",str),printf("%d ",a[str[i]-'A']);
    return 0;
}

标签:ABC,less,COCI2006,样例,three,P4414,order
From: https://www.cnblogs.com/suxiyiwang/p/17497908.html

相关文章

  • AtCoder Beginner Contest(abc) 306
    A-Echo题目大意把一个字符串的每个字符输出两遍解题思路签到题不多嗦了;神秘代码#include<bits/stdc++.h>#defineintlonglongusingnamespacestd;typedefpair<int,int>PII;constintN=1e6+10;intn,m;signedmain(){cin>>n;string......
  • abc055d <枚举>
    https://atcoder.jp/contests/abc055/tasks/arc069_b使用二进制枚举会更加简洁,要有从进制角度思考问题的习惯//https://atcoder.jp/contests/abc055/tasks/arc069_b//枚举,尝试前两个动物的4种组合,通过前两个动物的假设推出剩下的动物,而后检查是否存在冲突#include<......
  • abc054d <dp, 背包>
    https://atcoder.jp/contests/abc054/tasks/abc054_d//https://atcoder.jp/contests/abc054/tasks/abc054_d//背包//这里开始的时候数据规模想错了,所以用了map,实际上可以用数组(40*10)^2*40#include<iostream>#include<algorithm>#include<map>usingnamesp......
  • abc052d
    https://atcoder.jp/contests/abc052/tasks/arc067_b//https://atcoder.jp/contests/abc052/tasks/arc067_b//贪心即可,从左到右行动,每步选择代价小的方式#include<iostream>#include<algorithm>usingnamespacestd;typedeflonglongLL;constintN=1e5+10;......
  • abc051 <多源最短路>
    https://atcoder.jp/contests/abc051/tasks/abc051_d//https://atcoder.jp/contests/abc051/tasks/abc051_d//一条边不含于任何一条最短路中,当且仅当w[i][j]>dist[i][j],即存在一条最短路的权比这条边的权小#include<iostream>#include<algorithm>#include<cstrin......
  • abc050d <???>
    #include<iostream>#include<algorithm>#include<map>usingnamespacestd;typedeflonglongLL;map<LL,LL>mp;constLLmod=1e9+7;LLf(LLn){if(mp[n])returnmp[n];if(n&1){returnmp[n]=(......
  • 【230620-2】如图,在菱形ABCD中,AB=8,角D=60度,点F是CD的中点。点E是BC上一动点,连接AE、BF
    【230620-2】如图,在菱形ABCD中,AB=8,角D=60度,点F是CD的中点。点E是BC上一动点,连接AE、BF,点G、H分别是AE、BF的中点,连接GH,则GH的最小值是?......
  • abc049d <并查集>
    https://atcoder.jp/contests/abc049/tasks/arc065_b//https://atcoder.jp/contests/abc049/tasks/arc065_b//使用两个并查集维护连通关系//求并集,使用每个并查集的祖宗节点组成的pair表示这个交集#include<iostream>#include<algorithm>#include<map>usingnames......
  • AtCoder Beginner Contest(abc) 304
    A-FirstPlayer题目大意顺时针给定一个序列,序列的元素由一个字符串和一个数字组成;我们需要从有最小数字的元素开始,顺时针遍历整个序列,并输出字符串;解题思路签到题不多嗦了;神秘代码#include<bits/stdc++.h>#defineintlonglongusingnamespacestd;ty......
  • abc045d
    https://atcoder.jp/contests/abc045/tasks/arc061_b//https://atcoder.jp/contests/abc045/tasks/arc061_b//注意到每个格子染色仅能影响到周围范围的格子,因而对N个染色点进行枚举//为了不重复,仅枚举每个染色点影响到的右下侧共3*3个格子//统计每个格子被覆盖的次数,......