4 条题解

  • 3
    @ 2023-4-2 19:32:21

    最简

    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
        int n;
        cin>>n;
        cout<<n/100+n/10%10+n%10;
        return 0;
    }
    
    • 2
      @ 2024-2-13 19:08:25

      普通的方法没意思,来点劲爆的~

      已AC,请放心食用

      #include <iostream>
      using namespace std;
      int he(int n)
      {
          return n / 100 + n % 100 / 10 + n % 10;
      }
      int main(int n)
      {
          cin >> n;
          cout << he(n);
          return false;
          return 0;
      }
      

      不点赞,非好汉!点个赞吧( •̀ ω •́ )✧

      • 0
        @ 2023-8-31 15:27:13

        **

        #include <bits/stdc++.h>
        using namespace std;
        int main(){
            int n,g,s,b;
            cin >> n;
            b = n / 100;
            s = n / 10 % 10;
            g = n % 10;
            cout << b + s + g;
            return 0;
        }
        
        • 0
          @ 2023-1-9 22:27:29

          核心代码:

          a = (d % 100) % 10;
          b = (d % 100 - a) / 10;
          c = d / 100;
          
          • 1

          【入门】求任意三位数各个数位上数字的和

          信息

          ID
          294
          时间
          1000ms
          内存
          16MiB
          难度
          1
          标签
          递交数
          143
          已通过
          98
          上传者