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

 

上一篇:Dan Rosenberg


下一篇:JAVA Swing 多个按钮组