#include<stdio.h> #include <stdlib.h> int hf[3][3],ms[3][3],a[10]; int count=0; int get_ms(){ for(int i=0;i<3;i++){ if(hf[0][i]+hf[1][i]+hf[2][i]!=15)return 0; if(hf[i][0]+hf[i][1]+hf[i][2]!=15)return 0; } if(hf[0][0]+hf[1][1]+hf[2][2]!=15)return 0; if(hf[0][2]+hf[1][1]+hf[2][0]!=15)return 0; return 1; } void dfs(int pos){ if(pos==9){ if(get_ms()){ ++count; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { ms[i][j] = hf[i][j]; }
C语言程序设计教程(第三版)课后习题5.4 (C语言代码)浏览:1884 |
C语言程序设计教程(第三版)课后习题6.11 (C语言代码)for循环浏览:1099 |
十->二进制转换 (C语言代码)浏览:1291 |
Pascal三角 (C语言代码)格式错误浏览:516 |
C语言程序设计教程(第三版)课后习题5.7 (Java代码)浏览:884 |
C语言程序设计教程(第三版)课后习题8.1 (C语言代码)浏览:1242 |
C语言训练-亲密数 (C语言代码)浏览:682 |
C语言程序设计教程(第三版)课后习题5.4 (C语言代码)浏览:780 |
数组与指针的问题浏览:716 |
剪刀石头布 (C++代码)浏览:1699 |