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

推荐订阅源

Simon Willison's Weblog
Simon Willison's Weblog
P
Privacy International News Feed
www.infosecurity-magazine.com
www.infosecurity-magazine.com
T
Troy Hunt's Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
Attack and Defense Labs
Attack and Defense Labs
S
Secure Thoughts
V2EX - 技术
V2EX - 技术
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
O
OpenAI News
Cloudbric
Cloudbric
Google Online Security Blog
Google Online Security Blog
Schneier on Security
Schneier on Security
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Help Net Security
Help Net Security
Cyberwarzone
Cyberwarzone
G
GRAHAM CLULEY
L
Lohrmann on Cybersecurity
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Spread Privacy
Spread Privacy
NISL@THU
NISL@THU
N
News and Events Feed by Topic
T
Tenable Blog
S
Security @ Cisco Blogs
N
News and Events Feed by Topic
The Hacker News
The Hacker News
C
CXSECURITY Database RSS Feed - CXSecurity.com
宝玉的分享
宝玉的分享
月光博客
月光博客
酷 壳 – CoolShell
酷 壳 – CoolShell
美团技术团队
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google DeepMind News
Google DeepMind News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Tailwind CSS Blog
V
Visual Studio Blog
P
Proofpoint News Feed
Webroot Blog
Webroot Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 三生石上(FineUI控件)
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Jina AI
Jina AI
雷峰网
雷峰网
T
The Blog of Author Tim Ferriss
Hugging Face - Blog
Hugging Face - Blog
腾讯CDC
L
LangChain Blog
The Register - Security
The Register - Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 聂微东

博客园 - 程序猿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 }