规律题: #include<stdio.h> #include<math.h> #define eps 1e-8 int main() { int _case; int n,m,k,i; __int64 ans1; int ans2,ans; scanf("%d",&_case); ;i<=_case;i++) { scanf("%d%d%d",&n,&m,&k); printf("Case #…
题意:要把一块n*m*k的巧克力分成1*1*1的单元,有两种操作方式:1,用手掰(假设力量无穷大),每次拿起一块,掰成两块小的:2,用刀切(假设刀无限长),可以把多块摆在一起,同时切开.问两种方式各需多少次操作才能完成任务. 分析:用手掰很明显是(n*m*k-1)次操作.用刀切注意不是((n-1)+(m-1)+(k-1))次操作,这只是不动原巧克力的操作数.举个例子:1*1*4的巧克力,用刀切,按上面说的要3次操作,实际上只需2次.所以不管是长宽高,都只需要[log2n](或m,k)次操作. 注…
题意:有一块n*m*k的巧克力,最终需要切成n*m*k个1*1*1的块,问用以下两种方法最少掰多少次能达到目的: 1.用手掰:每次只能拿出一块来掰:2.用刀切:可以把很多已经分开的块摞在一起一刀切下来 分析: 1.用手掰,需要n*m*k-1次. 2.用刀切,可以分别考虑长宽高,计算长宽高分别切成单位长度所需要的最少次数,相加即可. 二分切,可得最少次数.规律为,长度为x最少需切ceil(log2(x))次. #include<cstdio> #include<algorithm>…
Break the Chocolate Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=4112 Description Benjamin is going to host a party for his big promotion coming up.Every party needs candies, chocolates and beer, and of cour…
题目链接:pid=3131">HDU 3131 One-Two-Five! (暴力搜索) 题意:给出一串数字,要求用加,减,乘,除(5/2=2)连接(计算无优先级:5+3*6=8*6=48),求全部结果中,含有'3'且该数字出现频率最大.若频率相等,输出数字最大的. 暴力解决之 AC代码: #include <stdio.h> #include <map> #include <string.h> #include <algorithm> #d…
p.MsoNormal { margin: 0pt; margin-bottom: .0001pt; text-align: justify; font-family: Calibri; font-size: 10.5000pt } h1 { margin-top: 5.0000pt; margin-bottom: 5.0000pt; text-align: center; font-family: 宋体; color: rgb(26,92,200); font-weight: bold; fo…
p.MsoNormal { margin: 0pt; margin-bottom: .0001pt; text-align: justify; font-family: Calibri; font-size: 10.5000pt } h1 { margin-top: 5.0000pt; margin-bottom: 5.0000pt; text-align: center; font-family: 宋体; color: rgb(26,92,200); font-weight: bold; fo…
HDU 3496 Watch The Movie(看电影) Time Limit: 1000MS   Memory Limit: 65536K [Description] [题目描述] New semester is coming, and DuoDuo has to go to school tomorrow. She decides to have fun tonight and will be very busy after tonight. She like watch cartoon…
HDU 5224 Tom and paper(最小周长) Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u   Description There is a piece of paper in front of Tom, its length and width are integer. Tom knows the area of this paper, he wants to know th…
HDU 5868 Different Circle Permutation(burnside 引理) 题目链接http://acm.hdu.edu.cn/showproblem.php?pid=5868 Description You may not know this but it's a fact that Xinghai Square is Asia's largest city square. It is located in Dalian and, of course, a landm…