上一页 1 2 3 4 5 6 7 ··· 21 下一页
博客内容经历了一次整理,以前发的博文太散、没什么水准,搞的随笔分类越来越多orz,这次把CPP这本书的课后练习的程序代码放到一起方便查阅与修改。。嗯9.6.1#ifndef _9.6.1_H_#define _9.6.1_H_#include #include const int Len = 40;struct golf{ char fullname[Len]; int handicap;};//non-interactive version//function sets golf structure to provided name, handicap//using values... Read More
posted @ 2013-11-08 16:00 瓶哥 Views(4218) Comments(2) Diggs(3) Edit
// binary.cpp -- binary file I/O#include #include #include #include //for exit()using namespace std;const char * file = "planets.dat";struct planet{ char name[20]; //name of planet double population; //its population double g; //its acceleration of gravity};inline void eat... Read More
posted @ 2013-11-08 15:51 瓶哥 Views(686) Comments(0) Diggs(0) Edit
posted @ 2013-11-07 21:37 瓶哥 Views(175) Comments(2) Diggs(0) Edit
DescriptionLet x and y be two strings over some finite alphabet A. We would like to transform x into y allowing only operations given below:Deletion: a letter in x is missing in y at a corresponding position.Insertion: a letter in y is missing in x at a corresponding position.Change: letters at corr Read More
posted @ 2013-10-27 17:52 瓶哥 Views(409) Comments(0) Diggs(0) Edit
一、递归计算#include using namespace std;/* 问题: 由非负组成的三角形,第一行只有一个数,除了最下行之外 * 每个数的左下方和右下方各有一个数,从第一行的数开始,每次可以 * 往左下或右下走一格,直到走到最下行,沿途的数相加,怎么走和最大? */const int N = 4;const int a[N][N] = {{1}, {3, 2}, {4, 10, 1}, {4, 3, 2, 20}};/* 把当前位置看成一个状态(i, j),定义状... Read More
posted @ 2013-10-26 11:11 瓶哥 Views(108) Comments(0) Diggs(0) Edit
Problem DescriptionRecently kiki has nothing to do. While she is bored, an idea appears in his mind, she just playes the checkerboard game.The size of the chesserboard is n*m.First of all, a coin is placed in the top right corner(1,m). Each time one people can move the coin into the left, the undern Read More
posted @ 2013-10-25 16:01 瓶哥 Views(251) Comments(0) Diggs(0) Edit
Problem Description十年前读大学的时候,中国每年都要从国外引进一些电影大片,其中有一部电影就叫《勇敢者的游戏》(英文名称:Zathura),一直到现在,我依然对于电影中的部分电脑特技印象深刻。 今天,大家选择上机考试,就是一种勇敢(brave)的选择;这个短学期,我们讲的是博弈(game)专题;所以,大家现在玩的也是“勇敢者的游戏”,这也是我命名这个题目的原因。 当然,除了“勇敢”,我还希望看到“诚信”,无论考试成绩如何,希望看到的都是一个真实的结果,我也相信大家一定能做到的~各位勇敢者要玩的第一个游戏是什么呢?很简单,它是这样定义的: 1、 本游戏是一个二人游戏; 2、 有 Read More
posted @ 2013-10-25 12:44 瓶哥 Views(249) Comments(0) Diggs(0) Edit
巴什博奕(Bash Game):只有一堆n个物品,两个人轮流从这堆物品中取物,规定每次至少取一个,最多取m个,最后取光者得胜。显然,如果n=m+1,那么由于一次最多只能取m个,所以,无论先取者拿走多少个,后取者都能够一次拿走剩余的物品,后者取胜。因此我们发现了如何取胜的法则:如果n=(m+1)r+s,(r为任意自然数,s≤m),那么先取者要拿走s个物品,如果后取者拿走k(≤m)个,那么先取者再拿走m+1-k个,结果剩下(m+1)(r-1)个,以后保持这样的取法,那么先取者肯定获胜。总之,要保持给对手留下(m+1)的倍数,就能最后获胜。这个游戏还可以有一种变相的玩法:两个人轮流报数,每次至少报一 Read More
posted @ 2013-10-24 22:21 瓶哥 Views(925) Comments(0) Diggs(0) Edit
/////////////////////////////////////////////////////////////////////////////// Name: personalrecord.h// Purpose: Dialog to get name, age, sex, and voting preference// Author: Julian Smart// Created: 02/28/04 06:52:49// Copyright: (c) 2004, Julian Smart// Licence: wxWindows... Read More
posted @ 2013-10-19 13:02 瓶哥 Views(1775) Comments(0) Diggs(0) Edit
#ifndef _WORKER_H_#define _WORKER_H_#include /**using std::cout;using std::cin;using std::endl;/**> id; while(cin.get() != '\n') { continue; }}/**> panache; while(cin.get() != '\n') { continue; }}/**> voice; while(cin.get() != '\n') { continue; }}/**#i... Read More
posted @ 2013-10-18 14:18 瓶哥 Views(230) Comments(0) Diggs(0) Edit
上一页 1 2 3 4 5 6 7 ··· 21 下一页