ACM
文章平均质量分 85
HTUN
Computer Science
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
POJ 1146 解题报告
解题思路: 和C++中STL的next_permutation类似,寻找序列的下一个排列。需注意的一点是,该序列中存在字母相同的数位,所以如果自己编写next_permutation的功能,在多个相同字母均可选择的情况下,需考虑优先选择哪一个。 next_permutation具体实现思路: 对于序列p1,p2,```,pn,其下一个全排列序列的方法原创 2012-12-23 22:27:19 · 1201 阅读 · 0 评论 -
Permutation 算法
#include #include typedef struct { int *arr; int length; }SqList; void Perm(SqList &L,int m) { int i,j,temp; if(m==L.length) { for(i=0;i<L.length;i++) printf("%d ",L.arr[i]); printf("原创 2012-12-23 22:23:43 · 1195 阅读 · 0 评论 -
POJ 1218 解题报告
水题一个,模拟实现就好。 源代码: #include #include using namespace std; class Prison { private: vector locked; vector unlocked; int N; public: void Init() { cin>>N; l原创 2012-12-23 22:29:45 · 621 阅读 · 0 评论 -
POJ 1218 解题报告
还是水题,模拟实现。唯一需要注意的地方就是输出的格式。如果一个单词一个单词的输入,并算出其编码再返回,会遇上PRESENTATION ERROR,因为你永远不知道下一个是不是END,所以你无法决定在该单词的译码输出之后该不该换行。所以用getline函数实现就好了,这样,你可以知道一行输入完毕,输出的时候也就输出一行罢了。 getline istream& get原创 2012-12-23 22:32:37 · 621 阅读 · 0 评论 -
POJ 1316 解题报告
水题一个,纯粹打表。不过值得注意的是用纯C++会TLE,主要是因为cin和cout的效率太低。所以这道题还是用C的printf比较好。 源代码: #include int main() { int temp,flag=1; for (int i=1;i<9994;++i) { flag=1; for (int原创 2012-12-23 22:34:10 · 679 阅读 · 0 评论 -
XOJ 1004.Sort Ver.2 From XMU
Description Give a set of numbers, output them after sort. You may use any algorithm you like to solve it. Input Each input file contains only one case. Each test case begins wit原创 2012-12-23 22:20:12 · 1274 阅读 · 0 评论
分享