C. Lieges of Legendre time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Kevin and Nicky Sun have invented a new game called Lieges of Legendre. In this game, two players take turns modifying…
Lieges of Legendre 题意:有n堆牛,每堆有ai头牛.两个人玩一个游戏,游戏规则为: <1>从任意一个非空的堆中移走一头牛: <2>将偶数堆2*x变成k堆,每堆x头牛(可以增加牛的个数) 移走最后一头牛的人获胜: 数据:n and k (1 ≤ n ≤ 100 000, 1 ≤ k ≤ 109).a1, a2, ... an (1 ≤ ai ≤ 109) 分析:这显然是SG函数与SG定理的应用: SG函数与SG定理:SG[x] = mex(S);其中S是所有x的后继…
C. Lieges of Legendre 题意:给n,m表示有n个为2的倍数,m个为3的倍数:问这n+m个数不重复时的最大值 最小为多少? 数据:(0 ≤ n, m ≤ 1 000 000, n + m > 0) ps:很水的题,主要是策略: 思路:由于里面每隔6就会重复一次,不好直接模拟,并且模拟的效率很低,那就二分吧!二分即上界为2单独的最大倍数与3单独时的最大倍数之和,下界为前面二者的max;之后利用判断是否mid/2 >= n && mid/3 >= m &am…
B. Moodular Arithmetic time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output As behooves any intelligent schoolboy, Kevin Sun is studying psycowlogy, cowculus, and cryptcowgraphy at the Bovinia S…
A. Alternative Thinking time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Kevin has just recevied his disappointing results on the USA Identification of Cows Olympiad (USAICO) in the form of…
A. Uncowed Forces Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/604/problem/A Description Kevin Sun has just finished competing in Codeforces Round #334! The round was 120 minutes long and featured five problems with maxi…