poj 3748 位操作

#include<iostream>        //位运算
using namespace std;
int main()
{
int r,x,y;
scanf(
"%x,%d,%d",&r,&x,&y);
r
=r&(~(1<<x));
r
=r|(1<<y);
r
=r|(1<<(y-1));
r
=r&(~(1<<(y-2)));
printf(
"%x\n",r);
return 0;
}

  

posted on 2011-07-18 00:11  sysu_mjc  阅读(120)  评论(0编辑  收藏  举报

导航