Poj Solution 3748

http://poj.org/problem?id=3748

import java.io.BufferedInputStream;
import java.util.Scanner;

/**
 *
 *poj3748
 * ���
 * @author NC
 */
public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedInputStream(System.in));
        if (scan.hasNext()) {
            String[] ss = scan.nextLine().trim().split("[,]");
            Integer r = Integer.parseInt(ss[0], 16);//��16���ƽ����ַ�
            Integer x = Integer.parseInt(ss[1]);//Ĭ�ϰ�10���ƽ���
            Integer y = Integer.parseInt(ss[2]);
            r = r & ~(0x1 << x);//��xλ���ó�0
            r = r & ~(0x1 << (y - 2));//0
            r = r | (0x1 << (y - 1));//1
            r = r | (0x1 << y);//1
            System.out.println(Integer.toHexString(r));
        }
    }
}

											
This entry was posted in poj. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *