hdu 5463 Clarke and minecraft
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5463
Clarke and minecraft
Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 366    Accepted Submission(s): 193
On that day, Clarke set up local network and chose create mode for sharing his achievements with others. Unfortunately, a naughty kid came his game. He placed a few creepers in Clarke's castle! When Clarke returned his castle without create mode, creepers suddenly blew(what a amazing scene!). Then Clarke's castle in ruins, the materials scattered over the ground.
Clark had no choice but to pick up these ruins, ready to rebuild. After Clarke built some chests(boxes), He had to pick up the material and stored them in the chests. Clarke clearly remembered the type and number of each item(each item was made of only one type material) . Now Clarke want to know how many times he have to transport at least.
Note: Materials which has same type can be stacked, a grid can store 64 materials of same type at most. Different types of materials can be transported together. Clarke's bag has 4*9=36 grids.
For each test case:
The first line contains a number n, the number of items.
Then n lines follow, each line contains two integer a,b(1≤a,b≤500), a denotes the type of material of this item, b denotes the number of this material.
The first sample, we need to use 2 grids to store the materials of type 2 and 1 grid to store the materials of type 3. So we only need to transport once;
#include <iostream>
#include <cstdio>
#include <cstring> using namespace std; int main()
{
int t;
int sum[];
scanf("%d",&t);
while (t--)
{
int n,Max=,ans=;
memset(sum,,sizeof(sum));
scanf("%d",&n);
while (n--)
{
int a,b;
scanf("%d%d",&a,&b);
sum[a]+=b;//a类有多少个
if (a>Max)
Max=a;
}
for (int i=; i<=Max; i++)
{
if (sum[i]==)
continue;
if (sum[i]%==)
ans+=sum[i]/;
else
ans+=(sum[i]/)+;
}
int aans;
if (ans%==)
aans=ans/;
else
aans=(ans/)+;
printf ("%d\n",aans);
}
return ;
}
hdu 5463 Clarke and minecraft的更多相关文章
- hdu 5463 Clarke and minecraft(贪心)
		
Problem Description Clarke is a patient with multiple personality disorder. One day, Clarke turned i ...
 - HDU 5628 Clarke and math——卷积,dp,组合
		
HDU 5628 Clarke and math 本文属于一个总结了一堆做法的玩意...... 题目 简单的一个式子:给定$n,k,f(i)$,求 然后数据范围不重要,重要的是如何优化这个做法. 这个 ...
 - BestCoder Round #56/hdu5463 Clarke and minecraft 水题
		
Clarke and 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 ...
 - hdu 5465 Clarke and puzzle 二维线段树
		
Clarke and puzzle Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php? ...
 - hdu 5464 Clarke and problem dp
		
Clarke and problem Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php ...
 - HDU 5628 Clarke and math dp+数学
		
Clarke and math 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5628 Description Clarke is a patient ...
 - HDU 5464 Clarke and problem 动态规划
		
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5464 Clarke and problem Accepts: 130 Submissions: ...
 
随机推荐
- SpringBoot(四)_Spring Data JPA的使用
			
JPA 绝对是简化数据库操作的一大利器. 概念 首先了解 JPA 是什么? JPA(Java Persistence API)是 Sun 官方提出的 Java 持久化规范.它为 Java 开发人员提供 ...
 - toast components
			
toast components https://jossmac.github.io/react-toast-notifications/ https://docs.microsoft.com/en- ...
 - cnblog博客CSS定制
			
一.页面定制CSS #home { margin: 0 auto; width: 80%;/*原始65*/ min-width: 980px;/*页面顶部的宽度*/ background-color: ...
 - CSS实现点击改变元素背景色
			
可通过使用css伪类实现点击元素变色的效果,两个伪类是:active, :focus :active :active选择器用于选择活动链接.当在一个链接上点击时,它就会成为活动的(激活的),:acti ...
 - CSU1392(NCPC2013)_Number Trick
			
给一个小数X,找个A使得:AX=(A循环左移一位) 首先,假设A为一个满足题目条件的数,有n个数位,且最高位数字为A0. 那么可列出方程:AX=(A-A0*10n-1)*10+A0 ————>& ...
 - LINQ 学习之筛选条件
			
从list 里遍历出 id="DM" 且 code="0000" 的数据 var tes1= from u in list.where u.ID == & ...
 - MT【135】条件线性化
			
已知\(x,y>0,\dfrac{1}{x}+\dfrac{2}{y}=1\),求\(\dfrac{1}{x+1}+\dfrac{2}{y+1}\)的最大值_____ 解答:令\(a=\dfra ...
 - [USACO12NOV]同时平衡线Concurrently Balanced Strings  DP map 思维
			
题面 [USACO12NOV]同时平衡线Concurrently Balanced Strings 题解 考虑DP. \(f[i]\)表示以\(i\)为左端点的合法区间个数.令\(pos[i]\)表示 ...
 - win7右下角的同步中心怎么去除
			
“开始”-“运行”-“regedit”,在“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Syncmgr\Handlers” ...
 - 【转】rt-thread的位图调度算法分析
			
序言 期待读者 本文期待读者有C语言编程基础,后文中要分析代码,对其中的一些C语言中的简单语句不会介绍,但是并不要求读者有过多的C基础,比如指针和链表等不会要求太多,后面在分析代码时,会附带地介绍相关 ...