1 条题解

  • 0
    @ 2025-4-12 21:33:53

    C++ :

    #include <iostream>
    using namespace std;
    int main()
    {
      int a[3];
      for(int i=0;i<3;i++)
        cin>>a[i];
      for(int j=0;j<3;j++)
      {
        if(a[j]<a[j+1])
        {
          int z=a[j];
              a[j]=a[j+1];
              a[j+1]=z;
          
        }
    	
      }
      for(int x=0;x<3;x++)
    	  cout<<a[x]<<" ";
      return 0;
    }
    

    Pascal :

    program t21244;
    var a,b,c,t:integer;
    begin
     readln(a,b,c);
     if a<b then 
       begin
         t:=a;a:=b;b:=t;
       end;
      if a<c then
        begin
         t:=a;a:=c;c:=t;
         end;
       if b<c then
         begin
         t:=b; b:=c;c:=t;
         end;
       writeln(a,' ',b,' ',c);
    end.
    
    • 1

    信息

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