描述 http://www.lydsy.com/JudgeOnline/problem.php?id=1619 给出一张图每个点的高度,在一个点上安排守卫可以监视周围所有不高于于当前点的点.也就是类似在一个点上灌水,周围(8格)低于它的点都会有水,然后继续...求最少的守卫数. 分析 首先图中的最高点必须是要灌水的,所以就从当前最高的开始宽搜,有水的点标记掉就好了. #include <bits/stdc++.h> #define fst first #define scd second us…
1619: [Usaco2008 Nov]Guarding the Farm 保卫牧场 Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 498  Solved: 223[Submit][Status] Description The farm has many hills upon which Farmer John would like to place guards to ensure the safety of his valuable milk…
题目 1619: [Usaco2008 Nov]Guarding the Farm 保卫牧场 Time Limit: 5 Sec  Memory Limit: 64 MB Submit: 491  Solved: 218 [Submit][Status] Description The farm has many hills upon which Farmer John would like to place guards to ensure the safety of his valuable…
不是严格小于是小于等于啊!!!!!不是严格小于是小于等于啊!!!!!不是严格小于是小于等于啊!!!!! 是我看不懂人话还是翻译不说人话= = 把所有格子按值排个序,bfs扩展打标记即可 #include<iostream> #include<cstdio> #include<algorithm> #include<queue> using namespace std; const int N=705,dx[]={-1,-1,-1,0,0,1,1,1},dy[…
闲来无事,由于校园内网络是限流量的,查询流量很是频繁,于是萌生了写一个本地脚本进行一键查询自己的剩余流量. 整个部分可以分为三个过程进行: 对登陆时http协议进行分析 利用python进行相关的模拟登陆 后期整合 第一部分:对登陆时http协议进行分析 模拟浏览器进行登陆,那么就需要知道当浏览器进行登陆时发生了什么事情.对此可以参见下面这张自制的图,它展示了一次浏览器访问一个地址的全过程. 图1 浏览器在地址框输入一个地址后发生的事情 参考自:http://www.linux178.com/w…
Description The farm has many hills upon which Farmer John would like to place guards to ensure the safety of his valuable milk-cows. He wonders how many guards he will need if he wishes to put one on top of each hill. He has a map supplied as a matr…
http://acm.hdu.edu.cn/showproblem.php?pid=5012 模拟出骰子四种反转方式,bfs,最多不会走超过6步 #include <cstdio> #include <cstdlib> #include <cmath> #include <cstring> #include <string> #include <queue> #include <vector> #include <i…
A. Combination Lock time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Scrooge McDuck keeps his most treasured savings in a home safe with a combination lock. Each time he wants to put there…
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4842 要注意题目中两点: 1.在踏入妖怪控制的区域那一刹那,先减行动力,然后才能杀妖怪 2.在妖怪控制区域行动力也会恢复 3.妖怪也许不在自己的控制区域 #include <cstdio> #include <cstring> #include <algorithm> #include <queue> using namespace st…
描述 http://www.lydsy.com/JudgeOnline/problem.php?id=1028 同一种花色的牌,序数为\(1,2,...,n\).定义"和了"为手上有\(3*m+2\)张牌,其中有一个对子,其他牌组成\(m\)组,每一组为顺子或刻子(三张完全相同).定义"听牌"为差一张牌"和了".现在给出\(n\)和\(3*m+1\)张牌,问是否听牌,听哪些牌? 分析 数据较小,可以直接模拟.枚举加哪一张牌,在判断加进去以后是否和…