题目 给出一棵树,每个节点有一个怪物或血药,遇到怪物必须打,打完后扣掉一定的血量. 一开始英雄的血量为\(0\),当血量小于\(0\)时就挂了. 给出英雄的起点和终点,问能否成功到达终点. 算法 这题的方法真的是太美妙了!感觉ACM的题目比OI的好多了,因为它的程序不长,并且每题都不容易想啊. 我们先来解决一个弱化版问题:把起点作为根,问英雄最多能加多少血. 我们可以想象每个点有一个礼包,这个礼包有两个属性,不妨用\((a,b)\)表示,表示当英雄的血量不少于\(a\)时可以加上\(b\)点血量…
题目 一开始有一个双头队列,每次添加一个数(这是数是二的幂,所有数的和不大于\(2^13\)),由你来决定添加到队头还是队尾.如果队列里面相邻的两个数相同,设它们都是\(x\),那么这两个数会合并为\(2x\).问所有数添加完后队列里能否只剩下一个数. 算法 搜索题,但是需要巧妙地记录状态!这种题不可多. 一个显然的是,队列里不会存在相邻的三个数\(a,b,c\),满足\(a>b,c>b\).这样的话,队列肯定是一个倒V字. 记状态\((i,j)\)为添加完前\(i\)个数,\(j\)是倒V左…
Regionals 2013 :: North America - Southeast USA It Takes a Village As a Sociologist, you are studying a certain kingdom. This kingdom has a capitol city, several villages, and roads between them all. Through your sociological studies, you have been a…
Glass Beads Time Limit: 3000ms Memory Limit: 131072KB This problem will be judged on UVALive. Original ID: 554564-bit integer IO format: %lld      Java class name: Main   Once upon a time there was a famous actress. As you may expect, she played most…
One-way traffic Time Limit: 3000ms Memory Limit: 131072KB This problem will be judged on UVALive. Original ID: 266464-bit integer IO format: %lld      Java class name: Main   In a certain town there are n intersections connected by two- and one-way s…
Bring Them There Time Limit: 3000ms Memory Limit: 131072KB This problem will be judged on UVALive. Original ID: 295764-bit integer IO format: %lld      Java class name: Main By the year 3141, the human civilization has spread all over the galaxy. The…
Ladies' Choice Time Limit: 6000ms Memory Limit: 131072KB This problem will be judged on UVALive. Original ID: 398964-bit integer IO format: %lld      Java class name: Main Background Teenagers from the local high school have asked you to help them wi…
Dividing coins Time Limit: 3000ms Memory Limit: 131072KB This problem will be judged on UVALive. Original ID: 558364-bit integer IO format: %lld      Java class name: Main It's commonly known that the Dutch have invented copper-wire. Two Dutch men we…
Critical Links Time Limit: 3000ms Memory Limit: 131072KB This problem will be judged on UVALive. Original ID: 529264-bit integer IO format: %lld      Java class name: Main In a computer network a link L, which interconnects two servers, is considered…
各国GDP数据可视化 数据来自世界银行 导入资源包,如下: Pandas, numpy, seaborn 和 matplotlib import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns 导入数据 数据下载 Country_GDP= pd.read_csv("Country_GDP.csv",sep=";") df = pd.DataFr…