7 条题解

  • 0
    a = input().split()
    print(' '.join(sorted(a, reverse=True)))
    
  • -1
    @ 2021-04-26 14:20:51

    #include<iostream>
    using namespace std;
    int main()
    {
    int a,b,c;
    cin>>a>>b>>c;
    if(a>b)
    if(b>c)
    cout<<a<<" "<<b<<" "<<c<<endl;
    else
    if(a>c)
    cout<<a<<" "<<c<<" "<<b<<endl;
    else
    cout<<c<<" "<<a<<" "<<b<<endl;
    else
    if(c<a)
    cout<<b<<" "<<a<<" "<<c<<endl;
    else
    if(c<b)
    cout<<b<<" "<<c<<" "<<a<<endl;
    else
    cout<<c<<" "<<b<<" "<<a<<endl;
    return 0;
    }

  • -1

    #include <iostream>
    using namespace std;
    int main()
    {
    int a,b,c;
    cin>>a>>b>>c ;
    if(a>b)
    {
    if(b>c)
    cout<<a<<" "<<b<<" "<<c;
    else
    {
    if(a>c)
    cout<<a<<" "<<c<<" "<<b;
    else
    cout<<c<<" "<<a<<" "<<b;
    }

    }
    else
    {
    if(c>b)
    cout<<c<<" "<<b<<" "<<a;
    else
    {
    if(a>c)
    cout<<b<<" "<<a<<" "<<c;
    else
    cout<<b<<" "<<c<<" "<<a;
    }

    }
    return 0;
    }

  • -1

    #include <iostream>
    using namespace std;

    int main()
    {
    int a,b,c, min;
    cin>>a>>b>>c;
    if(a>b && b>c) cout<<a<<" "<<b<<" "<<c<<endl; // 1 2 3
    if(a>c && c>b) cout<<a<<" "<<c<<" "<<b<<endl;
    if(b>a && a>c) cout<<b<<" "<<a<<" "<<c<<endl;
    if(b>c && c>a) cout<<b<<" "<<c<<" "<<a<<endl;
    if(c>a && a>b) cout<<c<<" "<<a<<" "<<b<<endl; // ???
    if(c>b && b>a) cout<<c<<" "<<b<<" "<<a<<endl; // 3 2 1
    }

  • -1
    #include<iostream>
    using namespace std;
    int main()
    {
        int a,b,c,x,y;
        cin>>a>>b>>c;
        x=a>(b>c?b:c)?a:(b>c?b:c);
        y=a<(b<c?b:c)?a:(b<c?b:c);
        cout<<x<<" "<<a+b+c-x-y<<" "<<y<<endl;
    
        system("pause");
        return 0;
    }
    
  • -2

    #include <iostream>
    using namespace std;

    int main()
    {
    int a,b,c, min;
    cin>>a>>b>>c;
    if(a>b && b>c) cout<<a<<" "<<b<<" "<<c<<endl; // 1 2 3
    if(a>c && c>b) cout<<a<<" "<<c<<" "<<b<<endl;
    if(b>a && a>c) cout<<b<<" "<<a<<" "<<c<<endl;
    if(b>c && c>a) cout<<b<<" "<<c<<" "<<a<<endl;
    if(c>a && a>b) cout<<c<<" "<<a<<" "<<b<<endl; // ???
    if(c>b && b>a) cout<<c<<" "<<b<<" "<<a<<endl; // 3 2 1
    }

  • -3

    #include <iostream>
    using namespace std;
    int main()
    {
    int a,b,c;
    cin>>a>>b>>c;
    if(a>b&&b>c) cout<<a<<" "<<b<<" "<<c<<endl;
    if(a>c&&c>b) cout<<a<<" "<<c<<" "<<b<<endl;
    if(b>c&&c>a) cout<<b<<" "<<c<<" "<<a<<endl;
    if(b>a&&a>c) cout<<b<<" "<<a<<" "<<c<<endl;
    if(c>a&&a>b) cout<<c<<" "<<a<<" "<<b<<endl;
    if(c>b&&b>a) cout<<c<<" "<<b<<" "<<a<<endl;
    return 0;

  • 1

A1-1 分支结构练习:三数排序

信息

难度
8
分类
(无)
标签
递交数
9964
已通过
1079
通过率
11%
被复制
15
上传者