Leetcode-5213 Play with Chips(玩筹码)

Posted asurudo

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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 ;

 

以上是关于Leetcode-5213 Play with Chips(玩筹码)的主要内容,如果未能解决你的问题,请参考以下文章

BZOJ4355Play with sequence 线段树

play with make

bzoj4355Play with sequence 线段树区间最值操作

HDU 3487:Play with Chain(Splay)

BZOJ-4353Play with tree 树链剖分

hdu 3487 Play with Chain (Splay)