| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:贴个代码,一次acIn Reply To:贴个代码,一次ac Posted by:youwang at 2010-03-24 10:06:53 > #include <stdio.h>
>
> #define setbit(x,y) x|=(1<<(y)) //将X的第Y位置1
> #define clrbit(x,y) x&=~(1<<(y)) //将X的第Y位清0
>
> int main()
> {
> int r, x, y;
> scanf("%x,%d,%d", &r, &x, &y);
> clrbit(r, x);
> setbit(r, y);
> setbit(r, y - 1);
> clrbit(r, y - 2);
> printf("%x\n", r);
> return 0;
> }
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator