Krypton Factor UVA
来源:互联网 发布:能美白牙齿的牙膏 知乎 编辑:程序博客网 时间:2024/06/05 12:43
每次取一个元素,符合就进行下次的选取就成。
唯一需要注意的是本题的格式必须看仔细,题目中讲的很详细:As such a sequence is potentially very long, split it into groups of four (4) characters separated bya space. If there are more than 16 such groups, please start a new line for the 17th group.别搞错啦
#include<cstdio>#include<cstring>int a[88], b[88], ser, len;void set_in(int l, int cnt) {if(ser == 0) {len = cnt;return;}for(int i=0; i<cnt; i++) a[i] = b[i];for(int i=0; i<l; i++) {int cur = 1;bool ok = true;a[cnt] = i;while(cur <= (cnt+1)/2) {ok = false;for(int j=0; j<cur; j++) if(a[cnt-j]!=a[cnt-j-cur]) ok=true;if(!ok) break;cur++;}if(ok) {if(ser) ser--; elsereturn;b[cnt] = i;set_in(l, cnt+1);}}}int main() {int l;const int zu = 16 * 4;while(scanf("%d%d", &ser, &l) && ser) {memset(a, 0, sizeof(a));set_in(l, 0);for(int i=0; i<len; i++) {printf("%c", b[i]+'A');if(i == len-1) {printf("\n");continue;}if(i%zu==(zu-1)) {printf("\n");continue;}if(i%4==3) printf(" ");}printf("%d\n", len);}}
0 0
- 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 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
- 紫书章七例五 Krypton Factor UVA
- 友善之臂NanoPC-T3 内核编译 遇到问题
- Mac系统下使用Hexo+GitHub搭建博客
- 开博啦
- 设计模式应用场合和对应jdk使用
- 微软云到底牛在哪儿?
- Krypton Factor UVA
- Flume环境部署和配置详解及案例大全
- SpringMVC_@ModelAttribute解决部分更新问题!!!
- Data binding的使用(三)----监听数据的变化
- qq. 微信分享出去的页面。如何唤起app,调到指定的页面
- HashMap和HashSet的区别
- Yii框架
- iOS 如何跳转到系统设置里的指定子功能界面
- 下拉刷新插件