hdu 6154 CaoHaha's staff】的更多相关文章

/* HDU 6154 - CaoHaha's staff [ 构造,贪心 ] | 2017 中国大学生程序设计竞赛 - 网络选拔赛 题意: 整点图,每条线只能连每个方格的边或者对角线 问面积大于n的图形最少要几条线 分析: 可以发现面积相同的情况下,每条线都连对角的菱形是最优的 再考虑如何将 面积为x^2的菱形,每次扩展一条边, 按最优扩展为面积为(x+1)^2的菱形 然后就可以先二分,再判断了 */ #include <bits/stdc++.h> using namespace std;…
题目代号:HDU 6154 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6154 CaoHaha's staff Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 777    Accepted Submission(s): 438 Problem Description "You shal…
CaoHaha's staff Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 487    Accepted Submission(s): 286 Problem Description "You shall not pass!"After shouted out that,the Force Staff appered in…
Problem Description "You shall not pass!"After shouted out that,the Force Staff appered in CaoHaha's hand.As we all know,the Force Staff is a staff with infinity power.If you can use it skillful,it may help you to do whatever you want.But now,hi…
题目链接 Problem Description "You shall not pass!" After shouted out that,the Force Staff appered in CaoHaha's hand. As we all know,the Force Staff is a staff with infinity power.If you can use it skillful,it may help you to do whatever you want. Bu…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6154 题意:在笛卡尔坐标系下,画一个面积至少为  n 的简单多边形,每次只能画一条边或者一个格子的对角线,问至少要画几条. 解法:如果一个斜着的矩形长宽分别是 a,b,那么它的面积是 2ab.最优解肯定是离 sqrt(n/2)很近的位置.想想 n=5 时答案为什么是7 然后在那个小范围内枚举一下就好了.我给一张做题时画的图 #include <bits/stdc++.h> using namesp…
Problem Description "You shall not pass!" After shouted out that,the Force Staff appered in CaoHaha's hand. As we all know,the Force Staff is a staff with infinity power.If you can use it skillful,it may help you to do whatever you want. But now…
[链接]点击打开链接 [题意] 给你一个面积,让你求围成这个面积最少需要几条边,其中边的连线只能是在坐标轴上边长为1的的线或者是两个边长为1 的线的对角线. [题解] 找规律题 考虑s[i]表示i条边能组成的最大面积. s[6]=4. s[7]=4+1.5=5.5 s[8]=4+4=8 s[9]=8+1.5=9.5 s[10]=8+4=12 s[11]=12+2.5=14.5 s[12]=12+=18 之后又重复一遍..s[13]=18+2.5,s[14]=18+6 可以发现,一开始x1 = 1…
题意:网格图.给你一个格点多边形的面积,问你最少用多少条边(可以是单位线段或单位对角线),围出这么大的图形. 如果我们得到了用n条边围出的图形的最大面积f(n),那么二分一下就是答案. n为偶数时,显然要尽量用斜边去拼矩形,于是f(i)=i*i/4-1 (i mod 4 == 2),f(i)=i*i/4-1(i mod 4 == 0). 当n为奇数时,尽量用i-1情况下的最长边向外扩张一个单位,于是f(i)=f(i-1)+[(i+1)/4]*2-1(i mod 2 == 1),方括号表示下取整.…
CaoHaha's staff Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 28    Accepted Submission(s): 17 Problem Description "You shall not pass!"After shouted out that,the Force Staff appered in C…