首页 > 其他 > 详细

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

时间:2019-06-16 10:53:17      阅读:220      评论:0      收藏:0      [点我收藏+]
 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(最小元素各数位之和)

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!