AtCoder ABC-161 A - ABC Swap
グラブルで古戦場が始まってしまったので今日は1問だけ...(しかもA問題)
方針
変数の入れ替えですね、tmp変数用意して入れ替えます。
(ネットでswap関数コピーしてくるのが手っ取り早い)
#include <stdio.h> #include <stdlib.h> #include <iostream> using namespace std; #define lli long ling int; int main() { int a, b, c; scanf("%d %d %d", &a, &b, &c); // a, b swap int tmp = 0; tmp = a; a = b; b = tmp; // a, c swap tmp = a; a = c; c = tmp; cout << a << " " << b << " " << c <<endl; return 0; }