mirror of
https://github.com/wczffl-503/OI-Codes.git
synced 2025-07-08 02:13:51 +08:00
更新了许多
This commit is contained in:
37
三整数排序.cpp
Normal file
37
三整数排序.cpp
Normal file
@ -0,0 +1,37 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a,b,c;
|
||||
cin >>a>>b>>c;
|
||||
if(a<=b && a<=c){
|
||||
cout <<a<<" ";
|
||||
}
|
||||
else if(b<=a && b<=c){
|
||||
cout <<b<<" ";
|
||||
}
|
||||
else if(c<=a && c<=b){
|
||||
cout <<c<<" ";
|
||||
}
|
||||
if((a>=c && a<=b) || (a<=c && a>=b)){
|
||||
cout <<a<<" ";
|
||||
}
|
||||
else if((b>=c && b<=a) || (b<=c && b>=a)){
|
||||
cout <<b<<" ";
|
||||
}
|
||||
else if((c>=a && a<=b) || (c<=a && c>=b)){
|
||||
cout <<c<<" ";
|
||||
}
|
||||
if(a>=b && a>=c){
|
||||
cout <<a;
|
||||
}
|
||||
else if(b>=a && b>=c){
|
||||
cout <<b;
|
||||
}
|
||||
else if(c>=b && c>=a){
|
||||
cout <<c;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user