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 ...
随机推荐
- CSS Ruler 前端工具
CSS Ruler是一款在线的CSS单位工具. CSS Ruler 彩蛋爆料直击现场 http://katydecorah.com/css-ruler/
- 相对布局RelativeLayout
一. public class RelativeLayout extends ViewGroup java.lang.Object ↳ android.view.View ↳ an ...
- POJ 1279 Art Gallery(半平面交求多边形核的面积)
题目链接 题意 : 求一个多边形的核的面积. 思路 : 半平面交求多边形的核,然后在求面积即可. #include <stdio.h> #include <string.h> ...
- js:字符串(string)转json
第一种方式: 使用js函数eval(); testJson=eval(testJson);是错误的转换方式. 正确的转换方式需要加(): testJson = eval("(" + ...
- UVA 11181 dfs 概率
N friends go to the local super market together. The probability of their buying something from them ...
- Struts2 Convention插件的使用(4)使用@Action注解返回json数据
package com.hyy.action; import java.util.HashMap; import java.util.Map; import org.apache.struts2.co ...
- http://jingyan.baidu.com/article/d169e186b38c37436611d8fa.html
http://jingyan.baidu.com/article/d169e186b38c37436611d8fa.html
- hadoop 1 testcase运行方法
转入hadoop2.0后,逐渐忘记了之前做testcase运行的方法,记录一下: ant -Dtestcase=Test*** 如果只运行core包得testcase可以 an ...
- iOS开发--沙盒路径与操作文件
获取应用沙盒根路径: -(void)dirHome{ NSString *dirHome=NSHomeDirectory(); NSLog(@"app_home: %@",dirH ...
- 8天学通MongoDB
随笔分类 - MongoDB 双十一来了,别让你的mongodb宕机了 摘要: 好久没过来吹牛了,前段时间一直赶项目,没有时间来更新博客,项目也终于赶完了,接下来就要面临双十一这场惊心动魄的处女秀考验 ...