UVA 10165 - Stone Game
题目链接
题意:给定n堆石子,每次能在一堆取1到多个,取到最后一个赢,问谁赢
思路:就裸的的Nim游戏,利用定理求解
代码:
#include
#include
int n, num;
int main() {
while (~scanf("%d", &n) && n) {
int sum = 0;
...
分类:
其他好文 时间:
2014-07-18 22:17:20
阅读次数:
342
UVA 12293 - Box Game
题目链接
题意:两个盒子,一开始一个盒子有n个球,一个只有1个球,每次把球少的盒子中球消掉,把多的拿一些球给这个盒子,最后不能操作的输(球不能少于1个),Alice先手,问谁赢
思路:博弈,题目其实可以转化为,给定一个n,每次把减少1到n/2的数字,最后谁是1谁就输了,那么可以去递推前几项找个规律,或者推理,都可以发现只要是2^i - 1...
分类:
其他好文 时间:
2014-07-18 21:27:44
阅读次数:
186
UVA 847 - A Multiplication Game
题目链接
题意:一个数一开始是1,每次轮流乘2-9,谁先大于n谁就赢,问谁胜
思路:博弈,找出必胜态,2-9为stan,10-18为ollie,19-162为stan...发现都是乘2乘9交替
代码:
#include
#include
#include
long long n;
bool ju...
分类:
其他好文 时间:
2014-07-18 21:27:15
阅读次数:
194
A Famous City Time Limit:7000MSMemory Limit:0KB64bit IO Format:%lld & %lluAfter Mr. B arrived in Warsaw, he was shocked by the skyscrapers and took se...
分类:
其他好文 时间:
2014-07-18 20:08:09
阅读次数:
245
这里讲的是Firefly《暗黑世界》碎片合成的流程部分的代码,这个主要是消息解析的部分,好吧上代码,代码路径app/game/gatenodeapp/compound.py。#coding:utf8'''Created on 2013-3-21物品合成@author: lan (www.9miao....
分类:
其他好文 时间:
2014-07-18 09:09:27
阅读次数:
204
class Solution {private: vector sum; vector step; set can;public: int jump(int A[], int n) { step.clear(), sum.clear(), can.clear()...
分类:
其他好文 时间:
2014-07-17 18:36:56
阅读次数:
221
Description
Tree Recovery
Little Valentine liked playing with binary trees very much. Her favorite game was constructing randomly looking binary trees with capital letters i...
分类:
其他好文 时间:
2014-07-17 17:21:38
阅读次数:
253
描述:本接口主要是根据城市名称 + 线路名称 模糊查找城市公交线路信息。
开源api接口:http://openapi.aibang.com/bus/lines?app_key=f41c8afccc586de03a99c86097e98ccb&city="+cityName+"&q="+line
其中cityName = URLEncoder.encode(cityName,"utf-8")...
简单的Lazy操作,统计的时候把所有的lazy都推到叶节点就可以了
City Horizon
Time Limit: 2000MS
Memory Limit: 65536K
Total Submissions: 15973
Accepted: 4336
Description
Farmer John has take...
分类:
其他好文 时间:
2014-07-17 14:39:18
阅读次数:
273
Description
There is a famous railway station in PopPush City. Country there is incredibly hilly. The station was built in last century. Unfortunately, funds were extremely limited that time. It wa...
分类:
其他好文 时间:
2014-07-17 10:41:03
阅读次数:
220