Kattis-ABC

Posted 做一个AC梦

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Kattis-ABC相关的知识,希望对你有一定的参考价值。

题目所述基本内容

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 a given order.

输入输出样例

Input

The first line contains the three positive integers A, B and C, not necessarily in that order. The 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

Output A, B and C in the desired order on a single line, separated by single spaces.

代码

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
using namespace std;

int main() 
	vector<int>a(3);
	map<char, int>c;
	string b;
	for (int i = 0; i < 3; i++) 
		cin >> a[i];
	
	cin >> b;
	sort(a.begin(), a.end());
	c['A'] = a[0];
	c['B'] = a[1];
	c['C'] = a[2];
	for (int i = 0; i < 3; i++) 
		cout << c[b[i]] << " ";
	

结束语

好兄弟好兄弟,留下你的关注和点赞,666走一波!!!!!

以上是关于Kattis-ABC的主要内容,如果未能解决你的问题,请参考以下文章

关于基础微积分的结束语

关于基础微积分的结束语

关于基础微积分的结束语

关于基础微积分的结束语

youcans 的 OpenCV 例程200篇结束语

C#如何结束EXCEL进程