1 solutions
-
0
C++ :
#include <iostream> #include <cstdio> using namespace std; int main() { int a,b,c,t; cin>>a>>b>>c; if(a<b)//确保a>=b { t=a;a=b;b=t; } if(a<c)//确保a>=c { t=a;a=c;c=t; } if(b<c)//确保b>=c { t=b;b=c;c=t; } printf("%d %d %d\n",a,b,c); return 0; }Pascal :
var i,j,temp:longint; a:array[1..10000] of longint; begin for i:=1 to 3 do read(a[i]); for i:=1 to 3-1 do for j:=i+1 to 3 do if a[i]<a[j] then begin temp:=a[i]; a[i]:=a[j]; a[j]:=temp; end; for i:=1 to 3 do write(a[i],' '); end.
- 1
Information
- ID
- 16926
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By