题意为 让m插入到n的第j位到第i位
方法1:
class BinInsert { public: int binInsert(int n, int m, int j, int i) { // write code here for(int k=0;k<=j+i;k++) { n|=((m>>k)&1)<<(j+k); } return n; } };
&就是取 |就是插入
方法二:
class BinInsert { public: int binInsert(int n, int m, int j, int i) { // write code here return n|=m<<j; } };
标签:code,二进制,here,插入,int,binInsert From: https://www.cnblogs.com/LonelyMoNan/p/16735464.html