Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
一点感想这是一个求全排列的问题,数组有重复元素。 求全排列有很多种方法,如递归、DFS等,但此题使用STL泛型函数十分简单。 核心代码如下: gets(s); sort(s); while(1) { puts(s); if(!next_permutation(s,strlen(s))) break; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator