码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2019-06-16 00:42:32      阅读:142      评论:0      收藏:0      [点我收藏+]

标签:for   minimum   最小   solution   pre   git   cto   最简   nim   

 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 };

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

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

标签:for   minimum   最小   solution   pre   git   cto   最简   nim   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!