摘要: 题意:党要重新给一个村庄的村民分配财产,n个村民(n >设第i个人给了xi个cions自己左边的人:则有——————————————>>x1 = x1 + 0;第1人:a[1] - x1 + x2 = M;——>>x2 = x1 - (a[1]-M)第2人:a[2] - x2 + x3 = M;——>>x3 = x1 - (a[1]-M) - (a[2]-M)……第n-1人:a[n-1] - x(n-1) + xn = M;——>>xn = x1 -(a[1]-M) - (a[2]-M) - ... - (a[n-1]-M);第n人:a[n 阅读全文
posted @ 2013-01-14 14:04 xiaodanding 阅读(106) 评论(0) 推荐(0) 编辑
摘要: 题意:指挥官给N个军人分配任务,需用 B[i] 的时间给第i个人陈述任务,而此人需用 J[i] 的时间去完成此任务。问最短执行完所有任务的总时间。题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=117&problem=2829——>>水题。#include #include using namespace std; const int maxn = 1000 + 10; struct soldier 阅读全文
posted @ 2013-01-14 12:33 xiaodanding 阅读(101) 评论(0) 推荐(0) 编辑
摘要: 题意:n条龙,m个骑士,n条龙的头的半径,m个骑士力所能及砍龙头半径,每一厘米,需支付骑士1个coin,问最少需支付多少个coin才能slay所有的龙,无解时,输出Loowater is doomed!。题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=24&problem=2267——>>先把龙的半径从小到大排序,骑士的能力从小到大排序,然后对骑士数组扫描一次即可。#include #include 阅读全文
posted @ 2013-01-14 11:04 xiaodanding 阅读(118) 评论(0) 推荐(0) 编辑