2 solutions

  • 1
    @ 2026-10-7 9:11:07
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
        int n;
        cin>>n;
        long long t=n;
        int maxv;
        for(int i=1;i<=n;i++)
        {
            long long x;
            cin>>x;
            long long t=x;
            int s=0;
            while(t)
            {
                int ge=t%10;
                s=s+ge;
                t=t/10;
            }
            if(i==1||s>maxv)
            {
                maxv=s;
            }
        }
        cout<<maxv;
    	return 0; 
    }
    

    Information

    ID
    2212
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    7
    Tags
    # Submissions
    118
    Accepted
    27
    Uploaded By