POJ 3620 DFS】的更多相关文章

题意: 给你n*m的矩形,有k个坏点 问最大坏点连通块的坏点数. 一发水题.. 裸的DFS // by SiriusRen #include <cstdio> #include <algorithm> using namespace std; int n,m,k,jy,jyx,jyy,xx[]={1,-1,0,0},yy[]={0,0,1,-1},a[105][105],vis[105][105],ans=0; void dfs(int x,int y){ for(int i=0;…
http://poj.org/problem?id=3620 DFS 从任意一个lake出发 重置联通的lake 并且记录 更新ans #include <iostream> #include <string.h> #include <stdio.h> using namespace std; int N,M,K; ][]; ][] = {-, , , , , , , -}; ; ; bool OK(int x, int y) { || x > N || y &l…
Avoid The Lakes Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 6795   Accepted: 3622 Description Farmer John's farm was flooded in the most recent storm, a fact only aggravated by the information that his cows are deathly afraid of wate…
题意:给出一个农田的图,n行m列,再给出k个被淹没的坐标( i , j ).求出其中相连的被淹没的农田的最大范围. 思路:dfs算法 代码: #include<iostream> #include<stdio.h> using namespace std; int t[150][150]; int visit[150][150]; int n,m,k; int dfs(int i,int j){ if(i<1||j<1||i>n||j>m||t[i][j]=…
Avoid The Lakes Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 6826   Accepted: 3637 Description Farmer John's farm was flooded in the most recent storm, a fact only aggravated by the information that his cows are deathly afraid of wate…
Description Farmer John's farm was flooded in the most recent storm, a fact only aggravated by the information that his cows are deathly afraid of water. His insurance agency will only repay him, however, an amount depending on the size of the larges…
题意:POJ少见的中文题,福利啊. 思路: 一开始也没有思路呃呃呃 . 裸搜,连样例都过不去...参照了网上的题解:一行一行DFS 茅塞顿开啊. #include <cstdio> #include <cstring> #include <algorithm> #include <iostream> using namespace std; char a[9][9]; bool vis[9]; int ans,n,m; void stmd(int row,i…
  fengyun@fengyun-server:~/learn/acm/poj$ cat 1979.cpp #include<cstdio> #include<iostream> #include<string> #include<algorithm> #include<iterator> #include<sstream>//istringstream #include<cstring> #include<que…
F - (例题)不等式放缩 Time Limit:1000MS     Memory Limit:10000KB     64bit IO Format:%I64d & %I64u Submit Status Practice POJ 1190 Description 7月17日是Mr.W的生日,ACM-THU为此要制作一个体积为Nπ的M层生日蛋糕,每层都是一个圆柱体. 设从下往上数第i(1 <= i <= M)层蛋糕是半径为Ri, 高度为Hi的圆柱.当i < M时,要求Ri &…
http://poj.org/problem?id=1562 #include<iostream> using namespace std; ,m=,sum=; ][]; ][]={-,, ,, ,-, ,, ,, -,-, -,, ,- }; void dfs(int a,int b) { if(!aa[a][b])return; aa[a][b]=; ;i<;i++) { ]; ]; &&a1<m&&b1>=&&b1<…