题目大意:有一只狐狸从给定的S点开始逃跑(出发),向叶节点移动以逃离这棵树,叶节点可能出现农民去抓捕狐狸,当农民和狐狸出现在同一个节点的时候,狐狸会被抓住,农民和狐狸移动速度相同,求抓捕狐狸所需要的最少农民数 显然,当 u 节点的子树内存在一叶节点 i 满足deep[i]-deep[u]<=deep[u]时,说明 u 的子树能被守住 即农民从 i 移动到 u 所需要的时间小于等于狐狸从出发点移动到 u 的时间 第一遍dfs预处理出每个节点的深度dep,以及每个节点的子树内深度最小的叶节点的深度m…
http://acm.zju.edu.cn/onlinejudge/showContestProblems.do?contestId=358 The 2014 ACM-ICPC Asia Mudanjiang Regional Contest 136 - The 2014 ACM-ICPC Asia Mudanjiang Regional Contest Solved ID Title Ratio (AC/All) Yes A Average Score 61.78% (456/738) Yes…
A Average Score http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5373 a班有n个人,b班有m个人,bob在a班,现在知道除了bob以外的所有人的成绩,还知道bob如果从a班转到b班,两个班的平均成绩都会提高,问bob合法的成绩区间. 解法,求一下两个班的平均成绩,bob的成绩肯定要比a班的小,比b班的大. #include<cstdio> int main(){ int t,n,m,x,sa,sb; w…
Dividing the Path Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 2858 Accepted: 1064 Description Farmer John's cows have discovered that the clover growing along the ridge of the hill in his field is particularly good. To keep the clo…
Problem E Watering Grass Input: standard input Output: standard output Time Limit: 3 seconds n sprinklers are installed in a horizontal strip of grass l meters long and w meters wide. Each sprinkler is installed at the horizontal center line of the s…
The winter is coming and all the experts are warning that it will be the coldest one in the last hundred years. Freddy needs to make sure that his garden does not sustain any damage. One of the most important tasks is to make sure that no water remai…
UVa 10382 - Watering Grass n sprinklers are installed in a horizontal strip of grass l meters long and w meters wide. Each sprinkler is installed at the horizontal center line of the strip. For each sprinkler we are given its position as the distance…