hdu5353】的更多相关文章

转载请注明出处: http://www.cnblogs.com/fraud/          ——by fraud Average Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 1457    Accepted Submission(s): 360Special Judge Problem Description There ar…
模拟,,, 每个人有一些糖果,每两个人之间只能给一个糖果,问最后是否能让所有人的糖果数量相同,只要确定一个糖果的流向其他的就能够确定. 马虎了,卡了好几天,心塞塞的... #include<iostream> #include<string.h> #include<stdio.h> using namespace std; ; int biaoji[maxa]; int vis[maxa]; ]; int ans(int a[], int n){ int sta; ;…
Problem Description There are n soda sitting around a round table. soda are numbered from 1 to n and i-th soda is adjacent to (i+1)-th soda, 1-st soda is adjacent to n-th soda. Each soda has some candies in their hand. And they want to make the numbe…
Each soda has some candies in their hand. And they want to make the number of candies the same by doing some taking and giving operations. More specifically, every two adjacent soda x and y can do one of the following operations only once: 1. x-th so…
题意:有n个小朋友,每个小朋友手上有一些糖,考虑每两个相邻的小朋友a.b,可以选择执行3种操作中的任一种:(1)a给b一粒糖(2)b给a一粒糖(3)不进行任何动作,问能否通过确定每两个相邻的小朋友的操作使得最终每个人的糖果数量相等. 思路:如果只有1个小朋友,那么肯定是可行的,如果糖果数总和取模小朋友数不为0,那么肯定是不可行的.令第i个小朋友的糖果数为a[i],首先将平均值ave计算出来,然后a[i]=a[i]-ave.注意到a[i]的值是确定的,且每个a[i]到达的目标值也是确定的,也就是0…