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

Leetcode-5213 Play with Chips(玩筹码)

时间:2019-10-06 15:14:33      阅读:58      评论:0      收藏:0      [点我收藏+]

标签:pair   tor   reg   code   size   shu   ++   type   return   

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

 

Leetcode-5213 Play with Chips(玩筹码)

标签:pair   tor   reg   code   size   shu   ++   type   return   

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

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