HDU 4476 Cut the rope
来源:互联网 发布:中国汽车出口现状知乎 编辑:程序博客网 时间:2024/05/21 21:49
题意:
每一条绳子可以剪一次,可以不剪。最多可以得到多少段一样长的绳子。
#include <cstdio>#include <cstring>#include <cmath>#include <iostream>#include <algorithm>#include <stack>#include <queue>using namespace std;const int N = 100009;int re[N],s[N];int n;int main(){ // freopen("in.txt","r",stdin); int cas; scanf("%d",&cas); while(cas--) { scanf("%d",&n); memset(re,0,sizeof(s)); int a; for(int i=0;i<n;i++) { scanf("%d",&a); re[a]++; } for(int i=1;i<N;i++) s[i] = s[i-1]+re[i]; int ans = 0; for(int i=1;i<N;i++) if(re[i]) { int tmp=n - s[((i-1)>>1)]; tmp+=re[i]; ans = max(ans,tmp); } cout<<ans<<endl; } return 0;}
- hdu 4476 Cut the rope
- hdu 4476 Cut the rope
- HDU 4476 Cut the rope
- hdu 4476 Cut the rope
- HDU-4476 Cut the rope (枚举、前缀和)
- cocos2d cut the rope
- NYOJ Cut the rope
- Cut The Rope正式登录pc
- hdu 4344 Mark the Rope
- hdu 4344 Mark the Rope
- HDU 4344 Mark the Rope
- html5在线网页游戏-Cut The Rope割绳子免费版
- cut the rope HTML 5版本背后的开发故事
- 《Cut The Rope》 HTML 5版背后的开发故事
- hdu - 4344 - Mark the Rope - 大数分解
- 用 Box2D 来制作类似 Cut the Rope 游戏里的绳子
- NYOJ 651 Cut the rope(DP, 经典的整数划分问题)
- 带你一起分析cut the rope(切绳子游戏)中绳子的制作方法
- C++ Placement New
- Linux Shell编程入门
- C语言链栈实现
- AT&T 汇编语言学习笔记一
- 手机报IN语
- HDU 4476 Cut the rope
- 100本世界名著浓缩成了100句话
- oracle varchar2类型字段中的空字符串和null
- Android ViewPaper实例
- 基于TQ2440的嵌入式linux步进电机驱动
- Ubuntu Software Center has closed unexpectly解决方案
- 中国佛学66句震撼世界的禅语
- 总是因为心存杂念无法专注而痛苦是因为信念还不够坚定——区分函数指针与指针函数
- HDU 4475 Downward paths