一日一练 六角填数
来源:互联网 发布:兄弟连php 百度云 编辑:程序博客网 时间:2024/05/01 05:10
//六角填数//2015-03-12//287283991@qq.com#include<iostream>#include<cstdio>#include<cstring>#include<cmath>using namespace std;#define eps 10e-10#define N 15static int A[N],vis[N];static int t[7];void dfs(int x){if(x==1||x==2||x==12){dfs(x+1);return ;}if(x>=13){int flag=true;t[1]=A[1]+A[3]+A[6]+A[8];t[2]=A[2]+A[3]+A[4]+A[5];t[3]=A[1]+A[4]+A[7]+A[11];t[4]=A[8]+A[9]+A[10]+A[11];t[5]=A[2]+A[6]+A[9]+A[12];t[6]=A[5]+A[7]+A[10]+A[12];for(int i=1;i<6;i++){if(t[i]!=t[i+1]){flag=false;return;}}if(flag){cout<<A[6]<<" ";}}if(x<13){for(int i=1;i<13;i++){if(!vis[i]){A[x]=i;vis[i]=1;dfs(x+1);vis[i]=0;}}}}int main(){for(int i=0;i<N;i++){vis[i]=0;}memset(vis,0,sizeof(vis));A[1]=1,A[2]=8,A[12]=3;vis[1]=1,vis[8]=1,vis[3]=1;dfs(1);return 0;}
http://blog.csdn.net/ljd4305/article/details/22101649#comments
因为身体原因耽误了好多事情
最近
蓝桥杯开始刷题
1 0
- 一日一练 六角填数
- 六角填数
- 六角填数
- 标题:六角填数
- 六角填数
- LQ_六角填数
- 六角填数
- 【蓝桥杯】【六角填数】
- 蓝桥杯 六角填数
- 1007-六角填数
- 蓝桥杯--六角填数
- 六角填数
- 六角填数
- 六角填数
- 六角填数
- 2014 六角填数
- 蓝桥杯 六角填数
- 六角填数
- 常见多媒体文件格式及视音频编解码总结
- AsyncTask、View.post(Runnable)、ViewTreeObserver三种方式总结frame animation自动启动
- Jboss和Tomcat
- opencv 2.4.4自带例子总结
- AI学习过程
- 一日一练 六角填数
- 苹果审核规则翻译
- 想写程序吗?远离你的计算机!
- 大话设计模式总结
- js中apply方法的使用
- 使用get或者post方式数据交互
- 操作系统常见简答题
- 在java语言中为什么有时候构造方法有时要构造一个没有参数的方法
- 高并发Web服务的演变——节约系统内存和CPU