Uva 10098 - Generating Fast
Problem C
Generating Fast, Sorted Permutation
Input: Standard Input
Output: Standard Output
题目链接:
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=107&page=show_problem&problem=1039
这题完全可以无视,但为什么通过率还没达到百分之五十呢?
#include<cstdio> #include<cstring> #include<algorithm> using namespace std; int main() { int n; char p[14]; scanf("%d", &n); for(int i=1; i<=n; ++i) { scanf("%s", p); int len = strlen(p); sort(p, p+len); do { for(int j=0; j<len; ++j) printf("%c", p[j]); printf("\n"); }while(next_permutation(p, p+len)); printf("\n"); } return 0; }
更多内容请关注个人微信公众号 物役记 (微信号:materialchains)
作者:雪影蓝枫
本文版权归作者和博客园共有,欢迎转载,未经作者同意须保留此段声明,且在文章页面明显位置给出原文链接,否则保留追究法律责任的权利。


浙公网安备 33010602011771号