ABC
Author: Pakin Olanraktham & Black Cat
Source: PROGRAMMING.IN.TH
Difficulty: ?
Tags: Ad-hoc
Prerequisites:
เฉลย
เฉลย
#include <stdio.h>
int main() {
int a, b, c;
scanf("%d %d %d", &a, &b, &c);
char q[4];
scanf("%s", q);
if (a > b) {int temp=a; a=b, b=temp;}
if (a > c) {int temp=a; a=c, c=temp;}
if (b > c) {int temp=b; b=c, c=temp;}
for (int i = 0; i < 3; i++) {
if (q[i] == 'A') printf("%d ", a);
else if (q[i] == 'B') printf("%d ", b);
else printf("%d ", c);
}
}
#include <iostream>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
string q;
cin >> q;
if (a > b) swap(a,b);
if (a > c) swap(a,c);
if (b > c) swap(b,c);
for (int i = 0; i < 3; i++) {
if (q[i] == 'A') cout << a << ' ';
else if (q[i] == 'B') cout << b << ' ';
else cout << c << ' ';
}
}