Rabbit and Grass

Nim博弈算法解析
本文通过HDU 1849题目介绍了Nim博弈的基本原理及实现方法,使用XOR运算来判断游戏胜负,为读者提供了清晰的代码示例。

http://acm.hdu.edu.cn/showproblem.php?pid=1849

Nin博弈

// File Name: hdu1849.cpp
// Author: bo_jwolf
// Created Time: 2013年10月01日 星期二 18:47:12

#include<vector>
#include<list>
#include<map>
#include<set>
#include<deque>
#include<stack>
#include<bitset>
#include<algorithm>
#include<functional>
#include<numeric>
#include<utility>
#include<sstream>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<ctime>

using namespace std;

int main(){
	int Case, temp, ans;
	while( scanf( "%d", &Case ) != EOF && Case ){
		ans = 0;
		while( Case-- ){
			scanf( "%d", &temp );
			ans ^= temp ;
		}
		if( ans ) printf( "Rabbit Win!\n" );
		else printf( "Grass Win!\n" );
	}
return 0;
}


世界排名第一的视频转换工具Grass Valley ProCoder 3.00.50汉化破解版 xzpd2012评语:这款软件的转换质量世界排名第一,传说价值10万人民币! 最新版为3.05.91(至2010年6月1号),但在我电脑上老出错,原因是无法导入大多数视频,甚至添加flv时会自动退出,不知其他人是否有这种情况,所以只提供3.00.50版的。我比较过,它的转换质量是所有软件中最好的。缺点是转换速度慢,软件体积大。适合对质量要求高的人。 安装方法: 1,你首先需要安装 quicktime(最好是默认目录),可以从官方网站下载最新版。 2,然后安装主程序 Grass Valley ProCoder 3.00.50汉化破解版(若安装过程中弹出对话框,只管按yes,确定,或next) 注意:安装完成后,桌面上会出现4个快捷方式: Job Queue Manager (队列管理器) ProCoder 3 Wizard (使用向导) ProCoder 3 (主程序) Watch Folder Setup(监视文件夹) 若(使用向导)无法使用。你可以双击运行ProCoder 3(主程序)快捷方式。若点击“转换”时弹出“这个预置设置无效”对话框,不要理它,继续点“确定”即可转换。 以下是软件介绍: 视频终极转换利器 Grass Valley ProCoder(原名:Canopus ProCoder) 目前,比较流行的压缩软件共有40多种,每一种都有其各自的优点和不足,一般来说,TMPEGenc可以说是其中的佼佼者,压缩后的画质在所有的压缩软件中可以说是名列前茅,在众多网友中的口碑相当的不错,缺点就是压缩的速度实在是很慢,对于机器配置比较低的朋友来说更是有些无法忍受; 当Canopus 公司的ProCoder 2.0正式推向市场之后,我们惊讶的发现,这款压缩软件阵营的新军的实力实在是不容小视,它在色彩表现、画面细节的表现方面等超过了TMPEGenc,更重要的是,它在压缩速度上更是大大超过了TMPEGenc,让我们做到了压缩的速度和画质的表现两者兼得! Grass Valley ProCoder 3 的前身就是广受赞誉的 Canopus ProCoder 2 ,其结合速度和灵活性于一体,是一款适合专业人士使用的先进的视频转换工具。作为广受赞誉的编码转换软件的领先者,ProCoder 3具有广泛的输入输出选项、先进的滤镜、批处理功能和简单易用的界面。 不管您是为制作DVD进行MPEG编码,或为流媒体应用进行Windows Media编码,或是为了NTSC和PAL之间相互转换,ProCoder3都能快速而方便地进行视频转换。可以将单个源文件同时转换成多个目标文件,用批处理模式连续进行多个文件的转换工作,或者用ProCoder3的拖放预设按钮进行一键式转换。 为了迎合当前的多格式编辑需要,ProCoder新版本新增和增强了一系列新的特性: 支持更多移动视频格式 — 新增H.264的编码和解码,ProCoder 3可以为时下流行的Apple iPod? 和Sony PSP?等移动视频设备转换和输出这些格式的文件。 增加了对EDIUS产品工作流程的更多支持 — ProCoder3已经包含了Canopus HQ编解码器,ProCoder可以独立进行Canopus HQ文件的编码和解码,而无需预先安装EDIUS软件。 支持AVCHD便携摄像机的格式 — 新增的AVCHD解码功能可以将新一代的AVCHD便携摄像机里的视频素材转换后用于编辑、输出流媒体或刻录DVD。 加快多核CPU系统的编码速度 — MPEG-2(传输流)的Grid编码支持,为新的多核或多CPU系统提供更快的编码速度。当你编码时选择“Preview DVD Target”或“HDV Target”时,将自动启动该特性进行编码。 支持杜比?数字音频 — 在进行DVD制作和复制过程中, ProCoder 3支持杜比数字音频的编码,在减小文件大小的同时提高了音频的质量。ProCoder 3还可以用内置的通道混合器来增加、改变和删除目标格式中的单独的音频通道。 ProCoder 3 关键特性: 将视频专业、高速度、高质量地编码转换成所有流行的媒体格式,包括 MPEG-1、MPEG-2、Windows Media?、QuickTime? 等等 MPEG-2(传输流、程序流)的Grid编码 – 选择“HDV Target”和“Preview DVD target”设置时,支持单台计算机中的多CPU和多核(包括双核和四核CPU) 新 用于自动编码的监视文件夹功能 具有优先级管理功能的任务队列管理器 缝合多个原文件后编码输出成一个单
c++题解,代码无注释 T-2 Rabbits and Grass 分数 35 作者 陈越 单位 浙江大学 There is a proverb(谚语)saying that “rabbits don’t eat grass around their nests”(兔子不吃窝边草). Now given several blocks of grass that are trimmed in a line. Assume that a rabbit starts eating from any block, and will never eat the neighboring blocks next. Your job is to tell the maximum amount of grass this rabbit can eat. Input Specification: Each input file contains one test case. For each case, two positive integers are given in the first line, namely N (≤10 5 ), the number of blocks, and i (1≤i≤N), the block index that the rabbit starts eating. Then N positive integers (≤10 3 ) are given in the next line, separated by spaces. The integers are the amount of grass in the corresponding blocks. Output Specification: Print in a line the maximum amount of grass this rabbit can eat. Then in the next line, print in order the indices of the blocks that rabbit eats. All the numbers in a line must be separated by 1 space, and there must be no extra space at the beginning or the end of the line. Note: we have to assume that the rabbit only jumps in one direction. Otherwise if it jumps back and forth, it can eat up all the grass. If both directions are okay for the rabbit, it always prefer jumping toward left. And more, if there are more than one block to choose from, the rabbit always prefer the nearest block it can jump to. Sample Input 1: 10 4 2 1 4 3 1 1 5 2 3 1 Sample Output 1: 11 4 7 9 Sample Input 2: 10 8 2 1 4 3 1 1 5 2 3 1 Sample Output 2: 9 8 6 3 1 代码长度限制 16 KB Java (javac) 时间限制 800 ms 内存限制 512 MB 其他编译器 时间限制 150 ms 内存限制 64 MB 栈限制 8192 KB
最新发布
08-22
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值