UVA--129
来源:互联网 发布:为知笔记vip破解版 编辑:程序博客网 时间:2024/05/17 06:52
题目点击打开链接
nm
神奇的PE
PE
最后发现错误点居然是 if判别式
&&的前后互换,没找到问题所在,只要将i放前面优先判断就是AC但是放后面就是pe,不太懂这是什么神奇的操作
#include <iostream>#include<cstdio>#include<cstring>#include<algorithm>using namespace std;int c[30];int n,m,l;int cnt;int dfs(int cur){ if(cnt++==n) { for(int i=0;i<cur;i++) { if(i&&(i%64==0))//神奇的开始点1 cout<<endl; else if(i&&i%4==0)//神奇的开始点2 cout<<" "; cout<<(char)('A'+c[i]); } cout<<endl<<cur<<endl; return 0; } for(int i=0;i<m;i++) { c[cur]=i; int ok=1; for(int j=1;j*2<=cur+1;j++) { int equ=1; for(int k=0;k<j;k++) { if(c[cur-k]!=c[cur-k-j]) { equ=0;break; } } if(equ) { ok=0; break; } } if(ok) if(!dfs(cur+1)) return 0; } return 1;}int main(){ while(cin>>n>>m&&n&&m) { cnt=0; dfs(0); } return 0;}
kjl
阅读全文
0 0
- uva 129
- UVA 129
- UVA--129
- uva 129 Krypton Factor
- uva 129 - Krypton Factor
- UVa 129 Krypton Factor
- UVA - 129 Krypton Factor
- UVa-129 - Krypton Factor
- UVa - 129 - Krypton Factor
- UVA - 129 Krypton Factor
- uva 129 - Krypton Factor
- uva 129 - Krypton Factor
- uva 129 回溯
- UVA 129 Krypton Factor
- UVA - 129 Krypton Factor
- UVa 129 Krypton Factor
- uva 129 Krypton Factor
- UVA 129 - Krypton Factor
- 2变量
- Python基础运算与字符串
- 面向对象(对象和类)
- anaconda2安装TVTK
- 欢迎使用CSDN-markdown编辑器
- UVA--129
- 字符串匹配的BF算法和KMP算法学习
- leetcode 20. Valid Parentheses
- Linux Kernel PANIC(二)--Hard Panic/Aieee实例分析
- four
- JVM查看命令
- 01_Python特征
- android检测不到手机设备
- 02_Python文件类型