- 博客(18)
- 收藏
- 关注
原创 八皇后问题 OpenJ_Bailian - 2698
[NWUACM] 在国际象棋棋盘上放置八个皇后,要求每两个皇后之间不能直接吃掉对方。 Input无输入。 Output按给定顺序和格式输出所有八皇后问题的解(见Sample Output)。 Sample OutputNo. 11 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 ...
2018-04-01 18:36:47
273
原创 Prime Ring Problem UVA - 524 回溯
A ring is composed of n (even number) circles as shown in diagram.Put natural numbers 1, 2, . . . , n into each circle separately, and thesum of numbers in two adjacent circles should be a prime.Note:...
2018-03-31 21:09:21
142
原创 常用函数-----素数
1.素数表a[i]==0则i为素数,n为所需素数的范围# include<iostream># include<cstring>using namespace std;int a[n];void su (){ int i; memset(a,0,sizeof(a)); for(i=2;i<n;i++){ if (a[i]==0){ int bei=2; wh...
2018-03-31 18:20:31
1031
原创 Robot Motion POJ - 1573
A robot has been programmed to follow the instructions in its path. Instructions for the next direction the robot is to move are laid down in a grid. The possible instructions are N north (up the page...
2018-03-31 18:09:42
131
原创 Piggy-Bank ----完全背包
Before ACM can do anything, a budget must be prepared and the necessary financial support obtained. The main income for this action comes from Irreversibly Bound Money (IBM). The idea behind is simple...
2018-03-15 17:53:52
171
原创 Tickets
Jesus, what a great movie! Thousands of people are rushing to the cinema. However, this is really a tuff time for Joe who sells the film tickets. He is wandering when could he go back home as early as...
2018-03-14 10:52:40
352
原创 Common Subsequence ----最长公共子序列
A subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = < x1, x2, ..., xm > another sequence Z = < z1, z2, ..., zk > is a ...
2018-03-13 21:11:07
138
原创 Super Jumping! Jumping! Jumping! -----最长上升子序列
Nowadays, a kind of chess game called “Super Jumping! Jumping! Jumping!” is very popular in HDU. Maybe you are a good boy, and know little about this game, so I introduce it to you now. The game can b...
2018-03-13 13:28:13
129
原创 Longest Ordered Subsequence -----最长上升子序列
A numeric sequence of ai is ordered if a1 < a2 < ... < aN. Let the subsequence of the given numeric sequence ( a1, a2, ..., aN) be any sequence ( ai1, ai2, ..., aiK), where 1 <= i1 < i2...
2018-03-12 22:48:53
187
原创 Ignatius and the Princess IV
"OK, you are not too bad, em... But you can never pass the next test." feng5166 says."I will tell you an odd number N, and then N integers. There will be a special integer among them, you have to tell...
2018-03-12 13:19:53
86
原创 Prime Path
The ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to change the four-digit room numbers on their offices. — It is a matter of sec...
2018-03-08 23:07:54
157
原创 Shuffle'm Up
A common pastime for poker players at a poker table is to shuffle stacks of chips. Shuffling chips is performed by starting with two stacks of poker chips, S1 and S2, each stack containing C chips. Ea...
2018-03-08 21:03:47
115
原创 Oil Deposits
The GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large rectangular region of land at a time, and creates a grid that divides th...
2018-03-08 19:29:34
111
原创 Find The Multiple
Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 and 1. You may assume that n is not greater than 200 and there...
2018-03-08 18:52:09
103
原创 Catch That Cow POJ - 3278
在很久很久以前,有一位大师级程序员,实力高强,深不可测,代码能力无人能及。从来没有人听说过他的真名,只知道他在完成一段代码后,总会跟上一行注释“十四出品,必属精品”,于是他在编程江湖上便有了绰号“十四”。 然而,十四大师并不满足于现有的一切,他想要让自己的实力有更进一步的提升。为此,他专程前往二次元世界修行。 二次元旅程归来的十四大师学习了新的技能——闪现。
2018-02-05 01:27:33
253
原创 POJ 1321-棋盘问题(dfs)
在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。Input输入含有多组测试数据。 每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及摆放棋子的数目。 n 当为-1 -1时表示输入结束。
2018-02-05 00:01:28
130
原创 Red and Black
POJ - 1979 求最多到达的数量-->dfswa一次,二维数组输入长和宽反了,导致矩阵输入错误。有一个长方形的房间,覆盖了正方形的磁砖。每块磁砖的颜色,要么是红色,要么是黑色。一名男子站在一块黑色的磁砖上。他可以从一块磁砖移至相邻四块磁砖中的某一块。但是,他不允许在红色磁砖上移动,他只允许在黑色磁砖上移动。 编写一个程序,使得他允许重复上述的移动,判断他所能到达的黑色
2018-01-26 17:13:51
114
原创 Dungeon Master
[POJ-2251]求最快的路径-->bfswa一次,Memory Limit Exceeded,超内存,由于忘记标记走过的点(vis数组),导致死循环,queue超内存。小技巧,可以将数组从i=1开始输入,初始化数组为“不能走”,可以不用判断边界。题目描述[NWUACM] 你被困在一个三维的空间中,现在要寻找最短路径逃生!空间由立方体单位构
2018-01-26 16:58:55
279
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人