惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
Microsoft Security Blog
Microsoft Security Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
V
Visual Studio Blog
宝玉的分享
宝玉的分享
IT之家
IT之家
人人都是产品经理
人人都是产品经理
T
The Blog of Author Tim Ferriss
I
InfoQ
B
Blog RSS Feed
T
Threatpost
博客园_首页
M
MIT News - Artificial intelligence
Spread Privacy
Spread Privacy
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Know Your Adversary
Know Your Adversary
U
Unit 42
Engineering at Meta
Engineering at Meta
C
Cyber Attacks, Cyber Crime and Cyber Security
月光博客
月光博客
Scott Helme
Scott Helme
T
Tor Project blog
有赞技术团队
有赞技术团队
AWS News Blog
AWS News Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Last Week in AI
Last Week in AI
S
Schneier on Security
Vercel News
Vercel News
博客园 - Franky
C
Cybersecurity and Infrastructure Security Agency CISA
L
LINUX DO - 热门话题
NISL@THU
NISL@THU
L
LangChain Blog
爱范儿
爱范儿
Google DeepMind News
Google DeepMind News
The GitHub Blog
The GitHub Blog
雷峰网
雷峰网
Latest news
Latest news
C
CXSECURITY Database RSS Feed - CXSecurity.com
Hugging Face - Blog
Hugging Face - Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
www.infosecurity-magazine.com
www.infosecurity-magazine.com
G
GRAHAM CLULEY
S
Security Affairs
A
About on SuperTechFans
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
大猫的无限游戏
大猫的无限游戏
W
WeLiveSecurity
Cisco Talos Blog
Cisco Talos Blog
罗磊的独立博客

博客园 - 程序猿101

2024年总结。。。。2025年规划。 对分布式一些理解 观察者模式 用redis实现悲观锁(后端语言以php为例) 只用200行Go代码写一个自己的区块链!(转) 用户中心 - 博客园 php的生命周期的概述 linux网络编程1 最简单的socket编程 mysql 慢查询 2016年终总结。。。六年从创业到技术的历程 Linux下chkconfig命令详解 这个简单明了啊 JS的prototype和__proto__ Constructor vagrant homestead laravel 编程环境搭建 发现一个百度的密码。。。记最近一段时间的php感想 mysql 的简单优化 百度面试题 字符串相似度 算法 similar_text 和页面相似度算法 百度的面试题 合并两个有序的数组 PHP性能优化工具–xhprof安装 Ecshop :后台添加新功能 菜单及 管理权限 配置
八皇后问题c语言版(xcode下通过)
程序猿101 · 2020-02-26 · via 博客园 - 程序猿101
 1 int arr[8][8] = {0}; //arr[row][col];
 2 
 3 
 4 //表示第几个棋子
 5 int check(int row,int col){
 6   
 7     //1,同一列不能有皇后
 8     for(int i = 0; i < 8; i++){
 9         if(arr[i][col] == 1){
10             return 0;
11         }
12     }
13     
14     //2,左斜上方,不能有皇后。
15     for(int i = row, j = col; i >= 0 && j >= 0; i--,j--){
16         if(arr[i][j] == 1){
17             return 0;
18         }
19     }
20     
21     //3,右上方,不能有皇后
22     for(int i = row, j = col; i >= 0 && j < 8; i--,j++){
23         if(arr[i][j] == 1){
24             return 0;
25         }
26     }
27     
28     return 1;
29 }
30 
31 void printfArr(){
32     for(int list = 0; list < 8; list++){
33         for(int line = 0; line < 8; line++){
34             if(arr[list][line] == 1){
35                 printf("(%d,%d)",list,line);
36             }
37         }
38     }
39     printf("\n");
40 }
41 
42 int count = 0;
43 void eightQueue(int row){
44     
45     if(row > 7){
46         printfArr();
47         count++;
48         return ;
49     }
50     
51     for(int col = 0; col < 8; col++){
52         if(check(row,col) == 1){
53             arr[row][col] = 1;
54             eightQueue(row + 1);
55             arr[row][col] = 0;
56         }
57     }
58 }