
枚举
huxinjianzs
这个作者很懒,什么都没留下…
展开
-
HDU-1261 字串数
原题:HDU-1261 n种字母排序总共有n!种不同的排法 假如字母B有m个,则字母B1,B2,B3...Bm一共有m!种排法 题目中说要去掉重复的 所以剩下的方法数量为 n!/m! #include #include #include using namespace std; int gcd(int a,int b) { if(b==0) return a;原创 2017-01-27 17:21:04 · 452 阅读 · 0 评论 -
排列 POJ - 1833
题目地址:POJ-1833 /* 当序列递减的时候才是最大 所以,先从后往前找到一个 s[n]<s[n+1]的n点 然后在n+1后面的点找一个s[k]s[n]的s[k]值最小的k点 k点与n交换 如果找不到则n点与n+1点交换 对n点以后的序列排序 */ #include #include #include using namespace std; int num[1200];原创 2017-02-26 09:41:59 · 390 阅读 · 0 评论 -
Lotto POJ-2245
原题:POJ-2245 #include #include using namespace std; int n; int num[20]; int suc[20]; void dfs(int t,int m){ int i; if(t>=6){ for(i=0;i<5;i++) printf("%d ",suc[i]);原创 2017-02-26 10:34:36 · 224 阅读 · 0 评论 -
Ignatius and the Princess II HDU - 1027
题目地址:HDU-1027 做法跟这个一样 排列 POJ - 1833 #include #include #include using namespace std; int n,k; int num[1000]; int main() { int i,x,y,MIN; while(~scanf("%d %d",&n,&k)) { for(i=原创 2017-02-26 11:02:24 · 213 阅读 · 0 评论