Description Cows are such finicky eaters. Each cow has a preference for certain foods and drinks, and she will consume no others. Farmer John has cooked fabulous meals for his cows, but he forgot to check his menu against their preferences. Although…
题意:有一个N行M列的正整数矩阵,输入N个前1~N行所有元素之和,以及M个前1~M列所有元素之和.要求找一个满足这些条件,并且矩阵中的元素都是1~20之间的正整数的矩阵.输入保证有解,而且1≤N,M≤20. 解法:这题的图转换得极妙!(*^▽^*)   我们可以发现找到的矩阵需要满足3个条件:1.N行M列:2.各行各列的和:3.各元素的大小.再仔细阅读一次题目,发现题目中提到的2个数字相同--"20",再想想这是不是有什么玄机.     首先可以找到第3个条件的转化,可以用容量来限制,…
410. [NOI2009] 植物大战僵尸 ★★★   输入文件:pvz.in   输出文件:pvz.out   简单对比时间限制:2 s   内存限制:512 MB [问题描述] Plants vs. Zombies(PVZ)是最近十分风靡的一款小游戏.Plants(植物)和Zombies(僵尸)是游戏的主角,其中Plants防守,而Zombies进攻.该款游戏包含多种不同的挑战系列,比如Protect Your Brain.Bowling等等.其中最为经典的,莫过于玩家通过控制Plants来…
题目描述 给定 nn 个点,mm 条有向边,给定每条边的容量,求从点 ss 到点 tt 的最大流. 输入格式 第一行包含四个正整数nn.mm.ss.tt,用空格分隔,分别表示点的个数.有向边的个数.源点序号.汇点序号. 接下来mm行每行包含三个正整数u_iui​.v_ivi​.c_ici​,用空格分隔,表示第ii条有向边从u_iui​出发,到达v_ivi​,容量为c_ici​ 输出格式 一个整数,表示ss到tt的最大流 输入输出样例 输入 #1  7 14 1 7 1 2 5 1 3 6 1 4…
Description On a grid map there are n little men and n houses. In each unit time, every little man can move one unit step, either horizontally, or vertically, to an adjacent point. For each little man, you need to pay a $1 travel fee for every step h…
Description Dearboy, a goods victualer, now comes to a big problem, and he needs your help. In his sale area there are N shopkeepers (marked from 1 to N) which stocks goods from him.Dearboy has M supply places (marked from 1 to M), each provides K di…
Problem Description Almost everyone likes kebabs nowadays (Here a kebab means pieces of meat grilled on a long thin stick). Have you, however, considered about the hardship of a kebab roaster while enjoying the delicious food? Well, here's a chance f…
Problem Description Gabiluso is one of the greatest spies in his country. Now he's trying to complete an "impossible" mission ----- to make it slow for the army of City Colugu to reach the airport. City Colugu has n bus stations and m roads. Eac…
Problem Description Our geometry princess XMM has stoped her study in computational geometry to concentrate on her newly opened factory. Her factory has introduced M new machines in order to process the coming N tasks. For the i-th task, the factory…
Description Alice, a charming girl, have been dreaming of being a movie star for long. Her chances will come now, for several filmmaking companies invite her to play the chief role in their new films. Unfortunately, all these companies will start mak…