4 条题解

  • 0
    @ 2025-10-23 23:10:34
    #include <bits/stdc++.h>
    using namespace std;
    int number(int n)
    {
        int t=0;
        int s = 0;
        while(n!=0)
        {
            t = n;
            t = t%10;
            s+=t;
            n/=10;
        }
        if(s<10)
        {
            return s;
        }
        else
        {
            return number(s);
        }
    }
    int main()
    {
        int n;
        cin>>n;
        cout<<number(n);
    }
    

    信息

    ID
    110
    时间
    1000ms
    内存
    256MiB
    难度
    6
    标签
    递交数
    26
    已通过
    11
    上传者