poj 1970(搜索)】的更多相关文章

The Game Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 6247   Accepted: 1601 Description A game of Renju is played on a 19*19 board by two players. One player uses black stones and the other uses white stones. The game begins in an emp…
catch that cow POJ 3278 搜索 题意 原题链接 john想要抓到那只牛,John和牛的位置在数轴上表示为n和k,john有三种移动方式:1. 向前移动一个单位,2. 向后移动一个单位,3. 移动到当前位置的二倍处.输出移动的最少次数. 解题思路 使用搜索,准确地说是广搜,要记得到达的位置要进行标记,还有就是减枝. 详情见代码实现. 代码实现 #include<cstdio> #include<cstring> #include<iostream>…
题目链接:http://poj.org/problem?id=1970 题意: 有一个19 × 19 的五子棋棋盘,其中“0”代表未放入棋子,“1”代表黑色棋子,”2“代表白色棋子,如果某方的棋子在横,纵,斜这四个方向的连子数(连着的棋子数)恰好为5,那么此方就可以获胜.给你某一刻棋盘上的棋子状态,问你在此刻是哪一方获胜,亦或是平局,平局时仅输出“0”;如果是黑色方获胜,那么输出“1“,白色方获胜输出“2”,并且在第二行输出五连子最左边的棋子的坐标,如果在纵方向五连子,那么输出最上面的那个棋子的…
目录 POJ 1426 POJ 1321 POJ 2718 POJ 3414 POJ 1416 POJ 2362 POJ 3126 POJ 3009 个人整了一些搜索的简单题目,大家可以clone来练习,vjudge链接直接公开了.以下部分代码省略了头文件,总之each就是for循环,rush()就是输入T个样例然后while(T--) vjudge练习地址:https://vjudge.net/contest/330414 POJ 1426 二进制的数实在太大了,所以用数组下标直接代表二进制数…
Dungeon Master Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 13923   Accepted: 5424 Description You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled…
题目链接:http://poj.org/problem?id=1011 #include<cstdio> #include<cstring> #include<algorithm> #include<iostream> using namespace std; ; int a[maxn]; int N; int sum; int len,cnt; bool used[maxn]; bool cmp(int a,int b){ return a > b;…
http://poj.org/problem?id=1190 题解:四个剪枝. #define _CRT_SECURE_NO_WARNINGS #include<cstring> #include<cctype> #include<cstdlib> #include<cmath> #include<cstdio> #include<string> #include<stack> #include<ctime>…
Network Saboteur Time Limit: 2000 MS Memory Limit: 65536 KB 64-bit integer IO format: %I64d , %I64u Java class name: Main [Submit] [Status] [Discuss] Description A university network is composed of N computers. System administrators gathered informat…
The Game Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 6886   Accepted: 1763 Description A game of Renju is played on a 19*19 board by two players. One player uses black stones and the other uses white stones. The game begins in an emp…
思路: 抄的题解 这叫搜索? 难以理解 我觉得就是枚举+逼近 //By SiriusRen #include <cmath> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; int n,recx,recy,x,y; int gcd(int a,int b){ return b?gcd(b,a%b):a; } int main(){ while(~sc…