上一页 1 ··· 157 158 159 160 161 162 163 164 165 ··· 182 下一页
摘要: 利用next_permutation,这个不需多余判断,直接就可处理由最后一个排列跳转到第一个排列的过程。用g++会tle,得用c++.View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>#include <algorithm>using namespace std;#define maxn 1028int f[maxn];int main(){ //freopen("D:\\t.txt", " 阅读全文
posted @ 2011-04-08 19:48 undefined2024 阅读(713) 评论(0) 推荐(0)
摘要: 简单题View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>#include <cmath>using namespace std;int main(){ //freopen("D:\\t.txt", "r", stdin); int t; scanf("%d", &t); for (int i = 0; i < t; i++) { double r; 阅读全文
posted @ 2011-04-08 19:25 undefined2024 阅读(215) 评论(0) 推荐(0)
摘要: 不重复的全排列,可以使用stl中的next_permutationView Code #include<iostream>#include<algorithm>#include<stdio.h>char a[250];using namespace std;int main(){ int len; scanf("%s",a); len=strlen(a); sort(a,a+len); do { printf("%s\n",a); } while(next_permutation(a,a+len)); return 0 阅读全文
posted @ 2011-04-08 19:08 undefined2024 阅读(219) 评论(0) 推荐(0)
摘要: 简单题View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using namespace std;#define maxn 10005int a[maxn];int cnt, n;int findit(){ for (int i = 1; i <= n; i++) if (a[i] != i) return i; return -1;}int main(){ //freopen("D:\\t.txt", &qu 阅读全文
posted @ 2011-04-08 18:27 undefined2024 阅读(242) 评论(0) 推荐(0)
摘要: 简单题View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using namespace std;int f[6];int main(){ //freopen("D:\\t.txt", "r", stdin); int t; scanf("%d", &t); while (t--) { for (int i = 0; i < 4; i++) scanf(" 阅读全文
posted @ 2011-04-08 18:14 undefined2024 阅读(183) 评论(0) 推荐(0)
上一页 1 ··· 157 158 159 160 161 162 163 164 165 ··· 182 下一页