#define setbit(x,y) x|=(1<<(y)) //将X的第Y位置1
#define clrbit(x,y) x&=~(1<<(y)) //将X的第Y位清0
...个人菜B做法:
#include <iostream>
using namespace std;
unsigned r,rp,x,y;
unsigned a[32]={0xfffffffe,0xfffffffd,0xfffffffb,0xfffffff7,
0xffffffef,0xffffffdf,0xffffffbf,0xffffff7f,
0xfffffeff,0xfffffdff,0xfffffbff,0xfffff7ff,
0xffffefff,0xffffdfff,0xffffbfff,0xffff7fff,
0xfffeffff,0xfffdffff,0xfffbffff,0xfff7ffff,
0xffefffff,0xffdfffff,0xffbfffff,0xff7fffff,
0xfeffffff,0xfdffffff,0xfbffffff,0xf7ffffff,
0xefffffff,0xdfffffff,0xbfffffff,0x7fffffff,};
int main()
{
while(scanf("%x,%d,%d", &r, &x, &y)!=EOF)
{
printf("%x\n",(((r&a[x])|(1<<y))|(1<<(y-1)))&a[y-2]);
}
return 0;
}
posted on 2010-03-25 15:50
wyiu 阅读(346)
评论(0) 编辑 收藏 引用 所属分类:
POJ