POJ 3049 DFS
来源:互联网 发布:mac版同花顺使用技巧 编辑:程序博客网 时间:2024/06/06 07:08
思路:暴搜
//By SiriusRen#include <cstdio>#include <iostream>#include <algorithm>using namespace std;int l,c,yuan,fu,lenth;char a[16],s[16];bool Yuan(char x){ if(x=='a'||x=='e'||x=='i'||x=='o'||x=='u')return 1; return 0;}void dfs(int x){ if(lenth==l){ if(yuan&&fu>=2)printf("%s\n",s+1); return; } for(int i=x;i<=c;i++){ lenth++; if(Yuan(a[i]))yuan++; else fu++; s[lenth]=a[i]; dfs(i+1); lenth--; if(Yuan(a[i]))yuan--; else fu--; }}int main(){ scanf("%d%d",&l,&c); for(int i=1;i<=c;i++)cin>>a[i]; sort(a+1,a+1+c); dfs(1);}
0 0
- POJ 3049 DFS
- DFS POJ
- POJ DFS
- poj 3083 DFS+DFS+BFS
- POJ 1753 ID+DFS
- poj 1950 数字dfs
- poj 1816(trie+dfs)
- POJ 3107 Godfather(DFS)
- poj 3620(DFS)
- poj 1020 DFS
- poj 2362Square(DFS)
- POJ 2676 Sudoku dfs
- POJ 2357 Labyrinth [DFS]
- poj 1011 dfs
- poj 1190 dfs(生日蛋糕)
- poj 1154 dfs
- poj 2192 DFS+剪枝
- 【DFS】POJ 2044
- Linux ifconfig 命令介绍
- Groovy的安装及常见问题
- 【Unity】查看与显示游戏帧数FPS
- PAT乙级(C++)1026-1030
- ubuntu VirtualBox 增加根目录空间
- POJ 3049 DFS
- Android自定义控件
- FTP java.net.ConnectException: Connection refused: connect
- 3673: 可持久化并查集 by zky
- Android Xfermode 实战 实现圆形、圆角图片
- LeetCode 371 Sum of Two Integers
- Hive数据仓库--Java代码JDBC方式访问Hive中表的数据
- GitHub上史上最全的iOS开源项目分类汇总
- Spring之Aop