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:尼玛啊,这题目我做了两个小时啊!!!!!!!!!In Reply To:尼玛啊,这题目我做了两个小时啊!!!!!!!!! Posted by:wwfdzh2013 at 2014-01-15 20:31:16 I think I got wrong answer by having newline at end of output (otherwise accepted) #include <stdio.h> int main(int argc, char *argv[]) { unsigned int v, x, y; scanf("%x,%u,%u", &v, &x, &y); v &= ~((unsigned int)1 << x); v |= ((unsigned int)1 << y); if (y > 0) v |= ((unsigned int)1 << (y - 1)); if (y > 1) v &= ~((unsigned int)1 << (y - 2)); printf("%x", v); return 0; } > #include<stdio.h> > int main() > { > int r,x,y,i,j; > unsigned int x_bit=0xfffffffe,y_bit=0x0000000c; > unsigned int t=0xfffffffd; > unsigned int temp; > scanf("%x,%d,%d",&r,&x,&y); > temp=x_bit>>(32-x); > x_bit=x_bit<<x; > x_bit=x_bit|temp; > temp=y_bit>>(32-y+3); > y_bit=y_bit<<(y-3); > y_bit=y_bit|temp; > temp=t>>(32-y+3); > t=t<<(y-3); > t=t|temp; > r=r&x_bit; > r=r|y_bit; > r=r&t; > printf("%x",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