- 博客(18)
- 收藏
- 关注
原创 (构造法)Tautology
Description WFF 'N PROOF is a logic game played with dice. Each die has six faces representing some subset of the possible symbols K, A, N, C, E, p, q, r, s, t. A Well-formed formula (WFF) is any s
2016-09-28 20:52:57 445
原创 (递推+大数据处理)Tiling
Description In how many ways can you tile a 2xn rectangle by 2x1 or 2x2 tiles? Here is a sample tiling of a 2x17 rectangle. Input Input is a sequence of lines, each line containing an int
2016-09-28 16:17:07 526
原创 (并查集)Ubiquitous Religions
Description There are so many different religions in the world today that it is difficult to keep track of them all. You are interested in finding out how many different religions students in your un
2016-09-28 14:46:38 237
原创 POJ_2586 Y2K Accounting Bug(贪心)
Y2K Accounting Bug Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 5785 Accepted: 2796 Description Accounting for Computer Machinists (ACM) has sufferred from the Y2K bug and lo
2016-09-24 19:56:08 301
原创 (C++水过去的)Power of Cryptography
Description Current work in cryptography involves (among other things) large prime numbers and computing powers of numbers among these primes. Work in this area has resulted in the practical use of r
2016-09-21 21:02:10 321
原创 面向对象程序设计上机练习七(类和对象)
Problem Description 利用类的数据成员和成员函数完成下列操作:输入三个整数,输出它们的最大值。 Input 输入三个整数。 Output 输出3个整数的最大值。 Example Input 2 8 5 Example Output 8 Hint Author #include using namespace std; clas
2016-09-21 15:56:50 424
原创 面向对象程序设计上机练习六(类和对象)
Problem Description 用类成员函数完成5个整型数组元素的输入、从小到大排序、排序后数组元素的输出。 Input 输入5个数组元素。 Output 输出5个数组元素从小到大排序后的结果。(最后一个数后面既没有空格也没有换行) Example Input 8 9 1 5 4 Example Output 1 4 5 8 9 Hint
2016-09-21 15:47:01 719
原创 2-2 Time类的定义(类与对象)
Problem Description 通过本题目的练习可以掌握类与对象的定义; 设计一个时间类Time,私有数据成员有hour(时)、minute(分)、second(秒); 公有成员函数有:setHour(int)设置数据成员hour的值(采用12小时制),非法的输入默认为12;setMinue(int)设置数据成员minute的值,非法输入默认为0;setSecond(int)设置
2016-09-21 15:26:10 621
原创 (C++)类与对象2-1 Point类的定义
Problem Description 通过本题目的练习可以掌握类与对象的定义; 设计一个点类Point,它具有私有数据成员x(横坐标)、y(纵坐标);公有成员函数:SetPoint(int,int)用于设置点对象的值,ShowPoint()用于输出点对象的信息 在主函数中调用成员函数SetPoint(int,int)为点对象设置值,并调用成员函数ShowPoint()输出点的信息。
2016-09-21 15:01:18 7895
原创 Radar Installation(贪心)
Description Assume the coasting is an infinite straight line. Land is in one side of coasting, sea in the other. Each small island is a point locating in the sea side. And any radar installation, loc
2016-09-21 14:49:39 212
原创 顺序表应用8:最大子段和之动态规划法
Problem Description 给定n(1负数时定义子段和为0,依此定义,所求的最优值为: Max{0,a[i]+a[i+1]+…+a[j]},1 注意:本题目要求用动态规划法求解,只需要输出最大子段和的值。 Input 第一行输入整数n(1 第二行依次输入n个整数,对应顺序表中存放的每个数据元素值。 Output 输出所求的最大子段和
2016-09-19 20:16:10 591
原创 顺序表应用7:最大子段和之分治递归法
Problem Description 给定n(1当所给的整数均为负数时定义子段和为0,依此定义,所求的最优值为: Max{0,a[i]+a[i+1]+…+a[j]},1<=i<=j<=n。 例如,当(a[1],a[2],a[3],a[4],a[5],a[6])=(-2,11,-4,13,-5,-2)时,最大子段和为20。 注意:本题目要求用分治递归法求解,除了需要输出最大子段
2016-09-19 20:05:35 789
原创 (枚举)The Pilots Brothers' refrigerator
Description The game “The Pilots Brothers: following the stripy elephant” has a quest where a player needs to open a refrigerator. There are 16 handles on the refrigerator door. Every handle can b
2016-09-13 20:31:24 282
原创 顺序表应用4-2:元素位置互换之逆置算法(数据改进)
Problem Description 一个长度为len(1 注意:交换操作会有多次,每次交换都是在上次交换完成后的顺序表中进行。 Input 第一行输入整数len(1 第二行输入len个整数,作为表里依次存放的数据元素; 第三行输入整数t(1 之后t行,每行输入一个整数m(1 Output 输出一共t行,每行依次输出本次交换完成后顺序表里所有元素。 E
2016-09-13 19:18:35 878
原创 数据结构实验之链表八:Farey序列
Problem Description Farey序列是一个这样的序列:其第一级序列定义为(0/1,1/1),这一序列扩展到第二级形成序列(0/1,1/2,1/1),扩展到第三极形成序列(0/1,1/3,1/2,2/3,1/1),扩展到第四级则形成序列(0/1,1/4,1/3,1/2,2/3,3/4,1/1)。以后在每一级n,如果上一级的任何两个相邻分数a/c与b/d满足(c+d) I
2016-09-12 21:31:22 461
原创 C++变量的引用
将变量的引用作为函数形参,实现2个int型数据交换。 Input 输入2个int型整数。 Output 输出2个整数交换前后的值。 Example Input 88 66 Example Output 88 66 66 88 Author #include using namespace std; void swap(int &a,int &b) {
2016-09-09 15:37:58 256
原创 c++函数模板
利用数组和函数模板求5个数最大值(分别考虑整数、单精度、长整数的情况)。 Input 分别输入5个int型整数、5个float 型实数、5个long型正整数。 Output 分别输出5个int型整数的最大值、5个float 型实数的最大值、5个long型正整数的最大值。 Example Input 11 22 666 44 55 11.11 22.22 33.33 888.8
2016-09-09 15:25:50 303
原创 Flip Game
Description Flip game is played on a rectangular 4x4 field with two-sided pieces placed on each of its 16 squares. One side of each piece is white and the other one is black and each piece is lying
2016-09-08 20:45:01 407
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人