1 条题解

  • 0
    @ 2025-4-12 21:43:14

    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

    信息

    ID
    1339
    时间
    1000ms
    内存
    128MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者