7 条题解

  • 4
    @ 2024-2-3 11:03:29

    四种不同结果的题解~

    已AC,请放心食用

    #include <bits/stdc++.h>
    using namespace std;
    int main()
    {
        int o, s, x = 1000, n = 0;
        cin >> o;
        s = o;
        while (s > 0)
        {
            n += s % 10 * x;
            s /= 10;
            x /= 10;
        }
        cout << o - n;
        return 0;
    }
    

    已WA,请小心食用

    #include <bits/stdc++.h>
    using namespace std;
    int main()
    {
        int o, s, x = 1000, n = 0;
        cin >> o;
        s = o;
        while (s > 0)
        {
            n += s % 10 * x;
            s /= 10;
            x /= 10;
        }
        cout << n - o;
        return 0;
    }
    

    已TLE,请小心食用

    #include <bits/stdc++.h>
    using namespace std;
    int main()
    {
        int o, s, x = 1000, n = 0;
        cin >> o;
        s = o;
        while (s > 0)
        {
            n += s % 10 * x;
            n /= 10;
            x /= 10;
        }
        cout << o - n;
        return 0;
    }
    

    已RE,请小心食用

    #include <bits/stdc++.h>
    using namespace std;
    int main()
    {
        int o, s, x = 1000, n = 0;
        cin >> o;
        s = o;
        while (s > 0)
        {
            n += s % 10 * x;
            s / 10;
            x / 10;
        }
        cout << o - n;
        return 0;
    }
    
    • 3
      @ 2022-12-16 22:21:10
      #include <iostream>//hetao3097453
      #include <cmath>
      using namespace std;
      int main()
      {
          int n,sum = 0,num = 0;
          cin >> n;
          int a = n / 1000;
          int b = n / 100 % 10;
          int c = n / 10 % 10;
          int d = n % 10;
          sum += a * 1 + b * 10 + c * 100 + d * 1000;
          num = n - sum;
          cout << num << endl;
          return 0;
      }
      
      
      • 2
        @ 2024-1-29 13:55:16
        #include<bits/stdc++.h>
        using namespace std;
        int main()
        {
            int a,n,x,y,z,sum=0;
            cin>>a;
            n=a*0.001;
            x=a*0.01-10*n;
            y=a*0.1-100*n-10*x;
            z=a-1000*n-100*x-10*y;
            sum=1000*z+100*y+10*x+n;
            cout<<a-sum;
            return 0;
        }
        
        • 1
          @ 2024-1-30 16:52:08
          #include <iostream>
          using namespace std;
          int main(){
              char a[4];
              cin>>a[0]>>a[1]>>a[2]>>a[3];
              cout<<(a[0]-'0')*1000+(a[1]-'0')*100+(a[2]-'0')*10+(a[3]-'0')-(a[3]-'0')*1000-(a[2]-'0')*100-(a[1]-'0')*10-(a[0]-'0');
              return 0;
          }
          
          • 1
            @ 2023-12-21 18:33:23

            字符串

            #include <bits/stdc++.h>
            using namespace std;
            int main()
            {
                string s;
                cin >> s;
                int a = (s[0] - '0'), b = (s[1] - '0'), c = (s[2] - '0'), d = (s[3] - '0');
                int ans1 = a * 1000 + b * 100 + c * 10 + d;
                int ans2 = d * 1000 + c * 100 + b * 10 + a;
                cout << ans1 - ans2 << endl;
                return 0;
            }
            
            • 1
              @ 2023-10-1 12:15:51
              #include <bits/stdc++.h>
              using namespace std;
              int sum,n;
              int main()
              {
                  cin>>n;
                  sum+=n/1000+n/100%10*10+n/10%10*100+n%10*1000;
                  cout << n-sum << endl;
                  return 0;
              }
              
              
              
              • 1
                @ 2022-12-13 9:09:08
                #include <iostream>
                using namespace std;
                int main()
                {
                	int a;
                	cin >> a;
                	cout << a - (a % 10 * 1000 + a / 10 % 10 * 100 + a / 100 % 10 * 10 + a / 1000);
                	return 0;
                }
                
                • 1

                信息

                ID
                699
                时间
                1000ms
                内存
                16MiB
                难度
                4
                标签
                递交数
                268
                已通过
                121
                上传者