- 博客(17)
- 收藏
- 关注
原创 DSA - Week 05 - 4 -Phone List
# include # include using namespace std; class tree_node{ public: char val; //to skip the type conversion tree_node* left_child; tree_node* right_sibling; tree_node(const char v = '\0', tree_
2013-11-08 18:27:17 356
原创 OPENJUDGE 4017 爬楼梯
这就是个Fibonacci数列问题我会乱说? # include using namespace std; int Recursion(int level) { if ( level == 0 ) { return 1; } else if ( level < 0 ) { return 0; } else return ( Recursion(level-1) +
2012-05-26 22:07:36 373
原创 OPENJUDGE 2775 文件结构图
时间限制: 1000ms 内存限制: 65536kB 描述在计算机上看到文件系统的结构通常很有用。Microsoft Windows上面的"explorer"程序就是这样的一个例子。但是在有图形界面之前,没有图形化的表示方法的,那时候最好的方式是把目录和文件的结构显示成一个"图"的样子,而且使用缩排的形式来表示目录的结构。比如: ROOT | dir1 | |
2012-05-19 17:27:10 583
原创 OPENJUDGE 1321 棋盘问题
1321:棋盘问题 查看 提交 统计 提问 时间限制: 1000ms 内存限制: 65536kB 描述 在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。 输入 输入含有多组测试数据。 每组数据的第一行是两个正整数,n k,用一个空格隔
2012-05-17 12:37:06 453
原创 OPENJUDGE 2925 大整数的因子
问题描述: 时间限制: 描述 已知正整数k满足2 输入 若干个非负整数c,c的位数 每行一个c,当c=-1时中止 (不要对-1进行计算!) 输出 每一个c的结果占一行 1) 若存在满足 c%k == 0 的k,输出所有这样的k,中间用空格隔开,最后一个k后面有空格。 2) 若没有这样的k则输出"none" 样例输入 30 72 13 -1 样例输出
2012-05-09 20:33:58 578
原创 OPENJUDGE 冷血格斗场
//upper_bound Returns the first elment beyond the range # include # include # include # include using namespace std; multimap member; int findMin(multimap::iterator& start, multimap::iterator&
2012-05-06 14:10:00 885
原创 OPENJUDGE SET
# include # include # include # include using namespace std; multiset storage; set history; void commandTranslator(string& s, int n) { if ( s == "add" ) { storage.insert(n); history.inser
2012-05-03 12:06:00 346
原创 OPENJUDGE LIST
# include # include # include # include # include # include using namespace std; map > listMap; void printList(list& l) { list::iterator i; for ( i = l.begin(); i != l.end(); i++ ) { pri
2012-05-03 12:05:09 444
原创 OPENJUDGE 热血格斗场
//STL Set And Map Supports ++&-- iterator # include # include # include # include using namespace std; map member; void match(int p) { int lower = 0; int upper = 0; map::iterator i; map::i
2012-05-03 12:03:34 2317
转载 OPENJUDGE Problem Classifications
初期: 一.基本算法: (1)枚举. (poj1753,poj2965) (2)贪心(poj1328,poj2109,poj2586) (3)递归和分治法. (4)递推. (5)构造法.(poj3295) (6)模拟法.(poj1068,poj2632,poj1573,poj2993,poj2996) 二.图算法:
2012-04-28 16:05:12 483
原创 OPENJUDGE 3754 字符环
Concatenate the input string twice like: s1 = ABCDEFABCDEF s2 = KLMNABKLMNAB for string (ABCDEF) and (KLMNAB) Restriction: The longest Ring would not be longer than the minimum length of the
2012-04-28 16:03:13 549
原创 OPENJUDGE 1273 DRAINAGE DITCHES
时间限制: 1000ms 内存限制: 65536kB 描述 Every time it rains on Farmer John's fields, a pond forms over Bessie's favorite clover patch. This means that the clover is covered by water for awhile and t
2012-04-27 15:56:37 947
原创 OPENJUDGE 4043 GPA排名系统
变量定义: 1) totalSum : Summation of All avaliable scores 2) lineSum[i] : Summation of all avaliable scores in a single line 3) studentNum : student Number 4) courseNum : course Number 5) zeroCount :
2012-04-26 23:39:37 374
原创 PROGRAMMING GRIDS 木棍正方形
前面用迭代不知道为什么出错,后来改用递归 算法思想: 首先若木棒长度和不是4的整数倍则不可能构成正方形,逐条边填充,如遇到一条边不能填充则CUT 考虑几种分支情况: 如果当前边剩余空间为0 若剩余木棒也为0,则已经填充完毕(此时一定恰好填充了4条边) 否则填充下一条边 对每条边设立使用标记,从未使用的第一条边开始逐个填入,填入时将访问标记设为true(之后归还),递归填其余边 如果
2012-04-21 01:48:39 1411
原创 OPENJUDGE 2745 显示器
Just Do it! Whatever..... # include # include using namespace std; //string line[11][3] = {{"-"," ","-"},{" "," "," "},{"-","-","-"},{"-","-","-"},{" "," "," "},{"-","-","-"},{"-","-","-"},{"-
2012-04-21 01:28:42 321
原创 OPENJUDGE 3713 外星人翻译用数字模块
Algorithm Abstract: 1)Establishing a Look_up Table As A Dictionary with STL map Structure; 2)Get Input And Push Items Into A Stack; 3)Pop Items In The Stack And Compare with items in the dictionary
2012-04-15 18:44:01 325
原创 OPENJUDGE 2815 城堡问题
OPENJUDGE 2815 城堡问题算法思想: 利用DFS搜索遍历整个空间。注意事项: 1)DON'T USE MEMSET FUNCTION TO INITIALIZE THE MATRIX!! 2)TAG FOR VISIT INFO ARE REQUIRED//SOURCE CODE# include # include # include # include # define
2012-04-15 18:21:41 396
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人