Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:尼玛啊,这题目我做了两个小时啊!!!!!!!!!

Posted by towelie at 2014-01-16 05:00:32 on Problem 3748 and last updated at 2014-01-16 05:08:41
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator