题目:这是一个经典问题,有n个海盗,分m块金子,其中他们会按一定的顺序提出自己的分配方案,如果50%以上的人赞成,则方案通过,开始分金子,如果不通过,则把提出方案的扔到海里,下一个人继续。
首先我们讲一下海盗分金决策的三个标准:保命,拿更多的金子,杀人,优先级是递减的。
同时分为两个状态稳定状态和不稳定状态:如果当n和m的组合使得最先决策的人(编号为n)不会被丢下海, 即游...
分类:
其他好文 时间:
2015-02-16 01:42:32
阅读次数:
144
Problem Description
The 15-puzzle has been around for over 100 years; even if you don't know it by that name, you've seen it. It is constructed with 15 sliding tiles, each with a number from 1 to 15 on it, and all packed into a 4 by 4 frame with one tile m...
分类:
编程语言 时间:
2015-02-15 09:29:04
阅读次数:
1023
A hard puzzle
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 32334 Accepted Submission(s): 11562
Problem Description
lcy gives a ha...
分类:
其他好文 时间:
2015-02-12 16:17:46
阅读次数:
145
题目地址:点这里
思路:可以先确定A,B的坐标,然后再通过确定向量来硬算出角度。。好像可以推公式做,没推出来╮(╯_╰)╭
AC代码:
#include
#include
#include
#include
#include
using namespace std;
const double PI = 4 *...
分类:
其他好文 时间:
2015-02-11 09:24:25
阅读次数:
202
Write a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character'.'.You may assume that there will be on...
分类:
其他好文 时间:
2015-02-10 14:56:42
阅读次数:
173
Then-queens puzzle is the problem of placingnqueens on ann×nchessboard such that no two queens attack each other.Given an integern, return all distinc...
分类:
其他好文 时间:
2015-02-10 14:39:14
阅读次数:
180
1.shuffle deck of cards and draw cards
import itertools,random
deck=list(itertools.product(range(1,14),['Spade','Heart','Diamond','Club']))
random.shuffle(deck)
for i in range(5):
print deck[...
分类:
其他好文 时间:
2015-02-10 09:16:33
阅读次数:
138
PuzzleA children's puzzle that was popular 30 years ago consisted of a 5x5 frame which contained 24 small squares of equal size. A unique letter of th...
分类:
其他好文 时间:
2015-02-08 16:43:58
阅读次数:
116
题目要求:Sudoku SolverWrite a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character'.'.You may assume tha...
分类:
其他好文 时间:
2015-02-07 18:49:37
阅读次数:
182
Solution to the n Queens Puzzle
Time Limit: 1000MS
Memory Limit: 131072K
Total Submissions: 3494
Accepted: 1285
Special Judge
Description
The eight queens puz...
分类:
其他好文 时间:
2015-02-07 09:13:07
阅读次数:
170