Leetcode-1085 sum of digits in the minimum number(最小元素各数位之和)

 1 #define _for(i,a,b) for(int i = (a);i < b;i ++)
 2 
 3 class Solution
 4 {
 5     public:
 6         int sumOfDigits(vector<int>& A)
 7         {
 8             int mm = A[0];
 9             _for(i,0,A.size())
10             {
11                 if(A[i]<mm)
12                     mm = A[i];
13             }
14             int S = 0;
15             while(mm)
16             {
17                 S += mm%10;
18                 mm /= 10;
19             }
20             if(S&0x1)
21                 return 0;
22             return 1;
23         }
24 };

我见过的有史以来力扣周赛出过的最简单的题

原文地址:https://www.cnblogs.com/Asurudo/p/11029387.html