poj 2886Who Gets the Most Candies?】的更多相关文章

POJ 2886 题目大意是说有n个人围成一圈,游戏的起点是k,每个人持有一个数字(非编号)num,每次当前的人退出圈,下一个人是他左边的第num个(也就是说下一个退出的是k+num, k可以为负数,表示右边的第num个),这里的num的范围是1e9, 现在一直如果一个人是第i个推出的,那么他的得分就是i的约束的个数,球得分最高的那个人的编号 这里有两个地方稍微不好处理: 1: num  < 1e9 这里只需要模拟一下就可以了,如果当前在k,往右走num,还剩下rest个人,那么下一步应该往右走…
http://poj.org/problem?id=2886 #include <cstdio> #include <cstring> #include <algorithm> #define maxn 500100 using namespace std; typedef long long ll; ]= {,,,,,,,,,,,,,,,}; int n,k; struct node { int l,r,num; } tree[maxn*]; ll maxsum,be…
题目链接:http://poj.org/problem?id=3159 Candies Time Limit: 1500MS   Memory Limit: 131072K Total Submissions: 33576   Accepted: 9422 Description During the kindergarten days, flymouse was the monitor of his class. Occasionally the head-teacher brought th…
Candies Time Limit: 1500MS   Memory Limit: 131072K Total Submissions: 20067   Accepted: 5293 Description During the kindergarten days, flymouse was the monitor of his class. Occasionally the head-teacher brought the kids of flymouse’s class a large b…
题目链接:http://poj.org/problem?id=3159 Description During the kindergarten days, flymouse was the monitor of his class. Occasionally the head-teacher brought the kids of flymouse’s class a large bag of candies and had flymouse distribute them. All the k…
POJ 3159 Candies (图论,差分约束系统,最短路) Description During the kindergarten days, flymouse was the monitor of his class. Occasionally the head-teacher brought the kids of flymouse's class a large bag of candies and had flymouse distribute them. All the kids…
题目传送门 #include <cstdio> #include <cstring> #define lson l, m, rt << 1 #define rson m+1, r, rt << 1 | 1 + ; ]; struct node { ]; int val; }boy[MAX_N<<]; int ans[MAX_N]; int id; int n, k; void build(int l, int r, int rt) { sum[r…
http://poj.org/problem?id=3159 Time Limit: 1500MS   Memory Limit: 131072K Total Submissions: 33328   Accepted: 9349 Description During the kindergarten days, flymouse was the monitor of his class. Occasionally the head-teacher brought the kids of fly…
Language:Default Candies Time Limit: 1500MS   Memory Limit: 131072K Total Submissions: 43021   Accepted: 12075 Description During the kindergarten days, flymouse was the monitor of his class. Occasionally the head-teacher brought the kids of flymouse…
Candies Time Limit: 1500MS   Memory Limit: 131072K Total Submissions: 22177   Accepted: 5936 Description During the kindergarten days, flymouse was the monitor of his class. Occasionally the head-teacher brought the kids of flymouse's class a large b…