HDU5463 Clarke and minecraft
解题思路:此题刚开始,觉得好繁琐,好混乱,理清思路后,发现很简单。
具体见代码分析。
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn = ;
int hash1[maxn]; //标记对应类型总共出现了多少个。
int main()
{
int t, n, a, b, sum, cnt;
scanf("%d", &t);
while(t--)
{
scanf("%d", &n);
memset(hash1, , sizeof(hash1));
while(n--)
{
scanf("%d %d", &a, &b);
hash1[a] += b; //hash1标记对应类型共出现多少个
}
sum = cnt = ;
for(int i = ; i <= ; i++) //因为a和b的取值范围都为500
{
if(hash1[i]) //如果出现过
{
sum += hash1[i]/; //sum记录总共要装多少个格子
if(hash1[i]%) sum ++; //如果不能整除,则要多放一个格子
cnt += sum/, sum %= ;//cnt记录总共要运多少次
}
}
if(sum) cnt ++; //如果sum没有整除,则要多运一次
printf("%d\n", cnt);
}
return ;
}
HDU5463 Clarke and minecraft的更多相关文章
- BestCoder Round #56/hdu5463 Clarke and minecraft 水题
Clarke and minecraft 问题描述 克拉克是一名人格分裂患者.某一天,克拉克分裂成了一个游戏玩家,玩起了minecraft.渐渐地,克拉克建起了一座城堡. 有一天,克拉克为了让更多的人 ...
- hdu 5463 Clarke and minecraft
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5463 Clarke and minecraft Time Limit: 2000/1000 MS (J ...
- hdu 5463 Clarke and minecraft(贪心)
Problem Description Clarke is a patient with multiple personality disorder. One day, Clarke turned i ...
- MineCraft note
客户端:http://pan.baidu.com/s/1hqgS8sshttp://pan.baidu.com/s/1mgmkduC 材质包:R3D小地图MODCraftGuide mod 内置合成表 ...
- Ubuntu上安装Minecraft服务器
Minecraft由于其独特的魅力吸引了很多玩家.不过游戏的乐趣只有在和朋友一起玩的时候才最有意思,所以很早以前我就想建设自己的服务器.但由于专业知识欠缺,没有实现. 最近接触了Linux服务器,所以 ...
- 纵观minecraft 游戏作者的世界观
minecraft 这款游戏 独特的游戏背景 与 模式 深受我爱 ,游戏的音乐制作方面也是独具一格 但是 整个游戏的风气 充满孤独的色彩 抑郁惆怅的音乐 每当在日出时 响起 ,当你进入生存模式之后 开 ...
- hdu 5565 Clarke and baton 二分
Clarke and baton Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php? ...
- hdu 5563 Clarke and five-pointed star 水题
Clarke and five-pointed star Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/show ...
- NVIDIA显卡设置提升MineCraft流畅度
很喜欢MineCraft(我的世界)这款游戏.可09年Y450的配置现在看来有点弱,尽管将Y450的CPU升级至了2.8Ghz的T9600,内存升级至1066Mhz的4G双通道内存,硬盘更换为128G ...
随机推荐
- HDU 1392 Surround the Trees (Graham求凸包周长)
题目链接 题意 : 让你找出最小的凸包周长 . 思路 : 用Graham求出凸包,然后对每条边求长即可. Graham详解 #include <stdio.h> #include < ...
- 2013 ACM/ICPC Asia Regional Changsha Online G Goldbach
比赛的时候,被题目误导了,题目最后说结果可能很大,要取模,那时就想直接求会TLE的!!! 赛后才知道,坑啊………… 代码如下: #include<iostream> #include< ...
- Codeforces Round #335 (Div. 2) D. Lazy Student 贪心
D. Lazy Student Student Vladislav came to his programming exam completely unprepared as usual. He ...
- Inlinehook PspCreateProcess
InineHook通过修改函数指令实现,此次以内核层的PspCreateProcess()为例. 本来是想写NtCreateProcess()的Inlinehook,但是想到PCHunter对于SSD ...
- IOS中延时执行的几种方式的比较
本文列举了四种延时执行某函数的方法及其一些区别.假如延时1秒时间执行下面的方法. - (void)delayMethod { NSLog(@"execute"); } 1.perf ...
- Bootstrap下拉菜单dropdown-menu
1.步骤 (1)要做为下拉菜单的li增加class="dropdown" (2)为li中文字添加超链接<a data-toggle="dropdown" ...
- http://blog.csdn.net/xiamizy/article/details/40781939
http://blog.csdn.net/xiamizy/article/details/40781939
- MyBatis学习总结_12_Mybatis+Mysql分页查询
package cn.tsjinrong.fastfile.util; /** * @ClassName: Page * @Description: TODO(分页组件的父类,用来封装分页的 通用内容 ...
- 编辑器Emacs下载网址(中国镜像)
Root gnu emacs windows File Name ↓ File Size ↓ Date ↓ Parent directory/ - - README 14K 2014-Nov-15 ...
- android布局 及 布局属性
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> ...