第一题(NOIP2010)
#include<iostream>
using namespace std;
void swap(int &a, int &b) {
int t;
t = a;
a = b;
b = t;
}
int main() {
int a1, a2, a3, x;
cin >> a1 >> a2 >> a3;
if (a1 > a2)
swap(a1, a2);
if (a2 > a3)
swap(a2, a3);
if (a1 > a2)
swap(a1, a2);
cin >> x;
if (x < a2)
if (x < a1)
cout << x << " " << a1 << " " << a2 << " " << a3 << endl;
else
cout << a1 << " " << x << " " << a2 << " " << a3 << endl;
else
if (x < a3)
cout << a1 << " " << a2 << " " << x << " " << a3 << endl;
else
cout << a1 << " " << a2 << " " << a3 << " " << x << endl;
return 0;
}
- 【判断题】去掉第14行到第19行,不会影响程序的运行结果。
{{ select(1) }}
- 【判断题】将第一行的iostream改成cstdio会编译错误。
{{ select(2) }}
- 【判断题】本题输出结果和将四个数从小到大排序一样。
{{ select(3) }}
- 【判断题】如果输入91 2 20 \n77,输出为2 20 77 91。
{{ select(4) }}
- 【选择题】如果输入114514 191 810 \n258,程序输出( )。
{{ select(5) }}
- 114 514 258 1919810
- 114514 191 810\n258
- 114514 191 810 258
- 191 258 810 114514
- 【选择题】如果输入1 1 1\n2,程序输出( )。
{{ select(6) }}
- 1 1 1 2
- 1 1 2 1
- 1 2 1 1
- 2 1 1 1