其他分享
首页 > 其他分享> > Leetcode-5213 Play with Chips(玩筹码)

Leetcode-5213 Play with Chips(玩筹码)

作者:互联网

 1 typedef long long ll;
 2 typedef pair<int,int> P;
 3 #define _for(i,a,b) for(register int i = (a);i < b;i ++)
 4 #define _rep(i,a,b) for(register int i = (a);i > b;i --)
 5 #define INF 0x3f3f3f3f
 6 #define MOD 100000000
 7 #define maxn 10003
 8 
 9 
10 class Solution
11 {
12     public:
13         int minCostToMoveChips(vector<int>& chips)
14         {
15             int shuang = 0,dan = 0;
16             _for(i,0,chips.size())
17             {
18                 if(chips[i]&0x1)
19                     dan ++;
20                 else
21                     shuang ++;
22             }
23             
24             return min(dan,shuang);
25         }
26 };

 

标签:Play,shuang,int,chips,dan,++,Chips,Leetcode,define
来源: https://www.cnblogs.com/Asurudo/p/11627154.html