UVa129 - Krypton Factor
来源:互联网 发布:java教程博客 编辑:程序博客网 时间:2024/04/29 22:32
<pre name="code" class="cpp">#include<iostream>#include<cstring>using namespace std;const int maxn = 85;int n,l,cnt,S[maxn];int dfs(int cur){ if(cnt++ == n){ for(int i=0; i<cur; i++){ if(i&&i%4==0&&i%64!=0) cout<<" "; if(i&&i%64==0) cout << endl; cout << (char)('A'+S[i]); } cout << endl; cout << cur << endl; return 0; } for(int i=0; i < l; i++){ S[cur]=i; bool ok = true; for(int j=1; j*2<=cur+1; j++){ bool equal=true; for(int k=0; k<j; k++) if(S[cur-k]!=S[cur-k-j]){ equal=false; break; } if(equal){ ok = false; break; } } if(ok) if(!dfs(cur+1)) return 0; } return 1;}int main(){ while(cin>>n>>l){ if(!n&&!l) break; cnt = 0; memset(S, 0, sizeof(S)); dfs(0); } return 0;}
0 0
- [回溯]Krypton Factor UVA129
- UVa129 - Krypton Factor
- UVA129 - Krypton Factor
- UVA129-Krypton Factor
- UVA129 Krypton Factor
- BNU17268 UVA129 Krypton Factor
- uva129 Krypton Factor
- UVA129 —— Krypton Factor (氪因素)
- 困难的串(Krypton Factor,UVa129)
- uva129||hdu 1627 Krypton Factor 回溯法
- UVa129 - Krypton Factor 不错的DFS入门题
- Uva129 Krypton Factor【dfs回溯】【例题7-5】
- Krypton Factor
- HDU-1627-Krypton Factor
- uva 129 Krypton Factor
- uva 129 - Krypton Factor
- UVa 129 Krypton Factor
- UVA - 129 Krypton Factor
- C语言学习笔记---001C语言的介绍,编译过程原理,工具等
- [****ViewController respondsToSelector:]: message sent to deallocated instance
- How To Include Custom Library Into Maven Local Repository?
- 兔子--Error generating final archive: Found duplicate file for APK: LICENSE
- ArrayList如何删除指定的几个数据?
- UVa129 - Krypton Factor
- 兔子--properties文件
- HaloDao进阶之面向sql动态视图的构思实现(三)
- 背包问题模板
- 优优云验证码识别积累一二
- android studio 下使用ndk——快速生成c/c++头文件
- HDU 2602 Bone Collector(0-1背包模板题)
- dll注入步骤
- [CF]Sums of Digits