HDU 2053 Switch Game】的更多相关文章

http://acm.hdu.edu.cn/showproblem.php?pid=2053 Problem Description There are many lamps in a line. All of them are off at first. A series of operations are carried out on these lamps. On the i-th operation, the lamps whose numbers are the multiple of…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2053 题目大意:灯开始是关着的,有n盏灯,i从1数到n每当灯的序号是i的倍数的时候就对灯进行一次操作(开->关,关->开),求最后第n盏灯是关着还是开着. 解题思路:直接对第n盏灯模拟也可以,但是有规律更好不是吗~.其实就是判断n的约束奇偶性,奇数就开着,偶数就关着. 当一个数不是完全平方数:如18约数为:(3,6),(2,19),(1,15)约数个数总会是偶数,因为每个约数都有一个对应的不同的约…
Switch Game Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 10200    Accepted Submission(s): 6175 Problem Description There are many lamps in a line. All of them are off at first. A series of op…
题意:在一个二维平面中,有n个灯亮着并告诉你坐标,每回合需要找到一个矩形,这个矩形xy坐标最大的那个角落的点必须是亮着的灯,然后我们把四个角落的灯状态反转,不能操作为败 思路:二维Nim积,看不懂啊,只能套模板了 参考:HDU 3404 Switch lights (NIM 积) 代码: #include<set> #include<map> #include<stack> #include<cmath> #include<queue> #inc…
Switch Game Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 13113    Accepted Submission(s): 7970 Problem Description There are many lamps in a line. All of them are off at first. A series of o…
http://acm.hdu.edu.cn/showproblem.php?pid=3404 题目 http://www.doc88.com/p-5098170314707.html 论文 nim积在22页附近 http://blog.csdn.net/kele52he/article/details/77099890 抄的代码的来源 根据论文相关部分和自己的理解的介绍.(nim积其实没什么卵用,学这种毒瘤的都有猫病.) nim和其实就是异或,想一下之前sg函数或者nim游戏结算的时候,是几堆在…
Ps:找规律题....凡是平方数都是开...WA了一次..数组给的太小?...后来给到3000..就AC了 代码: #include "stdio.h"long long dp[3000];int main(){ int i,n; for(i=1;i<3000;i++)  dp[i-1]=i*i; while(~scanf("%d",&n)){  for(i=0;i<3000;i++){   if(n==dp[i]) break;  }  if(…
主要是求NIM积!!! 代码如下: #include<iostream> #include<cstdio> #include<stack> #include<cstring> #define ll __int64 using namespace std; ][]; int nim(int x,int y); int _nim(int x,int y){ <<x+y; int &F=f[x][y]; )return F; ,e=; ;i&l…
Problem Description There are many lamps in a line. All of them are off at first. A series of operations are carried out on these lamps. On the i-th operation, the lamps whose numbers are the multiple of i change the condition ( on to off and off to…
(Nim积相关资料来自论文曹钦翔<从"k倍动态减法游戏"出发探究一类组合游戏问题>) 关于Nim积计算的两个函数流程: 代码实现如下: ][]={,,,}; int Nim_Multi_Power(int x,int y) { ) return m[x][y]; ; for(;;a++) <<(<<a))&&x<(<<(<<(a+)))) break; <<(<<a); int p…