1 solutions

  • 0
    @ 2025-7-12 16:20:17

    #include <bits/stdc++.h> using namespace std;

    int main() { int a[10], n, x,y ; cin >> n; a[4]=n%10; a[3]=n/10%10; a[2]=n/10/10%10; a[1]=n/10/10/10%10; sort(a+1,a+4+1); x=a[4]*1000+a[3]*100+a[2]*10+a[1]; y=a[1]*1000+a[2]*100+a[3]*10+a[4]; cout<<x-y; return 0; }

    • 1

    Information

    ID
    358
    Time
    1000ms
    Memory
    64MiB
    Difficulty
    1
    Tags
    # Submissions
    58
    Accepted
    40
    Uploaded By