题目:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3666题意:给一个有向图,然后A和B轮流移动棋子,棋子在每一个位置可以重叠,当某人不能走时,输!问A和B谁赢方法:显然每一局游戏都是独立的,对每一局游戏异或即可每一局游戏...
分类:
其他好文 时间:
2014-08-26 22:55:36
阅读次数:
359
题意:
在一个有向无环图上,有若干玩具,每人每次只能将一个玩具移动一步,玩具被移动到终点n将不能再被移动了,最后不能移动者输。
组合博弈
SG函数应用
#include
#include
#include
#include
using namespace std;
const int maxn = 10000 + 100;
int SG[maxn];
vector ...
分类:
其他好文 时间:
2014-08-26 21:32:06
阅读次数:
208
>>> reply = """Greetings...Hello %(name)s!Your age squared is %(age)s""">>> values = {'name': 'Bob', 'age':40}>>> print(reply % values)Greetings...Hel...
分类:
编程语言 时间:
2014-08-26 17:11:36
阅读次数:
335
Alice and Bob is playing a game, and this time the game is all about the absolute value!
Alice has N different positive integers, and each number is not greater than N. Bob has a lot of blank paper, ...
分类:
其他好文 时间:
2014-08-26 15:37:46
阅读次数:
228
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3798
Abs Problem
Time Limit: 2 Seconds Memory Limit: 65536 KB Special Judge
Alice and Bob is playing a game, and ...
分类:
其他好文 时间:
2014-08-25 21:16:24
阅读次数:
293
Abs ProblemTime Limit: 2 Seconds Memory Limit: 65536 KB Special JudgeAlice and Bob is playing a game, and this time the game is all about the absolute...
分类:
其他好文 时间:
2014-08-25 16:56:44
阅读次数:
261
Abs ProblemTime Limit: 2 Seconds Memory Limit: 65536 KB Special JudgeAlice and Bob is playing a game, and this time the game is all about the absolu.....
分类:
其他好文 时间:
2014-08-24 20:46:23
阅读次数:
203
8.23
在Python中,通常用全部大写的变量名表示常量。
列表:
classmates = ['Michael', 'Bob', 'Tracy']
还可以用-1做索引,直接获取最后一个元素:
也可以把元素插入到指定的位置,比如索引号为1的位置:
要删除list末尾的元素,用pop()方法:
要删除指定位置的元素,用pop(i)方法,其中i是索引位置:
tuple:
...
分类:
编程语言 时间:
2014-08-23 17:49:51
阅读次数:
203
思路介绍:
1. 如果首先由Alice取,定义ans[i],如果ans[i]=1表示Alice会取胜,反之Bob取胜。枚举前100项,ans[1]=0,ans[2]=1,ans[i]=!(ans[i-1]&&ans[i-2]);
可以发现规律:当i为2,3,5,6,8,9....时Alice取胜,所以Alice取胜的条件为:i%3!=1;
2.如...
分类:
其他好文 时间:
2014-08-21 09:54:03
阅读次数:
184
映射
import scala.collection.mutable
object HelloWorld {
def main(args: Array[String]) {
val scores = Map("Alice" -> 10, "Bob" -> 33) //构造一个不可变的Map[String,Int]
val scores2 = scala.collection....
分类:
其他好文 时间:
2014-08-18 16:24:32
阅读次数:
237