Avoid The Lakes Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 8173 Accepted: 4270 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…
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…
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…
题意:给出一个农田的图,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]=…
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…
Find The Multiple Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 28550 Accepted: 11828 Special Judge Description Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains…
DFS入门的一道经典题目:LakeCounting 用栈或队列来实现: #include<cstdio> #include<stdlib.h> #include<iostream> #include<stack> using namespace std; int n,m; int pla[10][3]={{1,0},{1,1},{1,-1},{-1,-1},{-1,0},{-1,1},{0,-1},{0,1}};//对坐标进行移动的向量 struct pla…