poj 1003 (nyoj 156) Hangover】的更多相关文章

点击打开链接 题目大意 就是有很多卡片可以沿着桌边向外放,每次可以伸出1/2,1/3,1/4问最少多少卡片才能让一张完成的卡片悬空,题目输入卡片的宽度,输出卡片个数 #include<stdio.h> int array[550]; int main() { int i, j; double sum = 0; array[0] = 0; for(i = 1, j = 1; j < 521; i++) { sum += 1.0/(i + 1); int n = sum * 100; for…
点击打开链接 Brainman Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 7810   Accepted: 4261 Description Background  Raymond Babbitt drives his brother Charlie mad. Recently Raymond counted 246 toothpicks spilled all over the floor in an instan…
点击打开链接 Drainage Ditches Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 49648   Accepted: 18829 Description Every time it rains on Farmer John's fields, a pond forms over Bessie's favorite clover patch. This means that the clover is cove…
这是到动态规划的题目,属于有顺序的0 1 背包问题: 代码: #include<stdio.h> #include<string.h> ][]; //d[i][j] ]; int N; int max(int a, int b) { return a>b?a:b; } int solve(int i,int high) { ) return d[i][high]; if(i==N) { if(a[i]<high) ; else ; } if(a[i]<high)…
链接:http://poj.org/problem?id=3335     //大牛们常说的测模板题 ---------------------------------------------------------------- Rotating Scoreboard Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 5158   Accepted: 2061 Description This year, ACM/ICPC…
链接:http://poj.org/problem?id=3122 Pie Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 10448   Accepted: 3694   Special Judge Description My birthday is coming up and traditionally I'm serving pie. Not just one pie, no, I have a number N…
| 1 2 3 4 5 6 | | 3 6 5 1 4 2 | 在一个置换下,x1->x2,x2->x3,...,xn->x1, 每一个置换都可以唯一的分解为若干个不交的循环 如上面那个  可以 =>(1,3,5,4)  1的下面是3  :3的下面是5 一直循环.   (2,6) 一个循环,有两种处理方法: ①用这个循环中最小的元素,依次与相应元素交换,直到该循环内所有元素归位 ②用这个循环中最小的元素与所有数中最小的元素交换,然后用所有数中最小的元素依次与相应元素交换,直到该循环…
POJ——3169Layout Layout Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 14702   Accepted: 7071 Description Like everyone else, cows like to stand close to their friends when queuing for feed. FJ has N (2 <= N <= 1,000) cows numbered 1..N…
###POJ 3252 题目链接 ### 题目大意:给你一段区间 [Start,Finish] ,在这段区间中有多少个数的二进制表示下,0 的个数 大于等于 1 的个数. 分析: 1.很显然是数位DP,枚举这区间中所有数的二进制位数.由于与 0 的个数有关,故需要用 lead 标记前导零情况. 2.然后就是要处理 1 的个数与 0 的个数,故 dp 的第二维状态即要表示出枚举到当前位 pos 时所拥有的 0 的个数 (或 1). 但是你会发现,如果当前知道的是 前面几位中 0 的个数,为了满足题…
链接:http://poj.org/problem?id=3368 题意:给出n个连续单调不递减数,q次询问,每次询问区间(L,R)出现频率最多的数,问出现了多少次 思路:因为n个数是单调不递减的,所以可以预处理一个频率数组cnt[ ],cnt[ i ]记录某个数到 i 位置时,出现了多少次,再预处理一个index数字,记录每一段相同的数字,最右端的位置,因为每次询问的时候可能会出现一部分连续的数被L这个位置隔开,cnt[i]只记录了某个数到i位置出现了多少次,被隔开的部分多算了,所以需要减去,…