HDU 4388 Stone Game II(博弈)
来源:互联网 发布:成都软件开发工资水平 编辑:程序博客网 时间:2024/05/22 06:23
http://acm.split.hdu.edu.cn/showproblem.php?pid=4388
找规律:
如果所有石头数的二进制中1的总个数是奇数且n为偶数 胜
如果所有石头数的二进制中1的总个数是偶数且n为奇数 胜
其他情况 败
//package acm.hdu2388;import java.util.*;public class Main {public static int getone(int n){int res = 0;while (n!=0){if ((n&1)!=0){++res;}n >>=1;}return res;}public static void main(String[] args) {// TODO Auto-generated method stub@SuppressWarnings("resource")Scanner in = new Scanner(System.in);int T = in.nextInt();for (int kas = 1;kas <= T;++kas){int n = in.nextInt();int s = n;for (int i = 1,x;i <= n;++i){x = in.nextInt();s += getone(x);}if ((s&1)!=0)System.out.println("Case "+kas+": Yes");else System.out.println("Case "+kas+": No");}}}
0 0
- HDU 4388 Stone Game II(博弈)
- HDU 4388 Stone Game II 博弈,规律题
- HDU 4387 Stone Game 博弈
- hdu 1729 Stone Game 【博弈-找规律】
- A simple stone game - HDU 2486 K倍递减博弈
- HDU 1729 Stone Game(博弈 + SG函数)
- HDU 4764-Stone(博弈)
- HDU 4764 Stone(博弈)
- [博弈]A Funny Stone Game
- hdu 1729 Stone Game
- Hdu 1729 Stone Game
- hdu 4387 Stone Game
- hdu 4387 Stone Game
- HDU 1729 Stone Game
- HDU 1729 Stone Game
- hdu 1729 Stone Game
- hdu 4764 Stone(博弈)
- HDU 4764 Stone(博弈+推理)
- 博客记录
- C结构小结
- android性能优化之布局优化
- (Mac版)Android Studio 设置提示不区分大小写
- Jdbc-数据库使用工具类
- HDU 4388 Stone Game II(博弈)
- 页面验证和业务字典
- android mark
- GMS基础知识
- android NDK开发之NDK与JNI
- Android中Intent对象与Intent Filter过滤匹配过程详解
- MPChart饼图自定义图例
- 把json转为实体对象
- __NotificationCenter事件通知中心(观察者模式)