BestCoder Round #56 (div.2)(Clarke and minecraft)
2015-09-19 22:48
190 查看
Clarke and minecraft
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 114 Accepted Submission(s): 63
Problem Description
Clarke is a patient with multiple personality disorder. One day, Clarke turned into a game player of minecraft.
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.
Input
The first line contains a number T(1≤T≤10),
the number of test cases.
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.
Output
For each testcase, print a number, the number of times that Clarke need to transport at least.
Sample Input
2 3 2 33 3 33 2 33 10 5 467 6 378 7 309 8 499 5 320 3 480 2 444 8 391 5 333 100 499
Sample Output
1 2 Hint: 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;
哎!今天不知道怎么了?这么简单的题目竟然错了,细节决定成败
直接模拟
相关文章推荐
- opencv训练分类器(HAAR,LBP等特征)
- hdu 5452 Minimum Cut 树形dp
- wxWidgets Tips: Compile wxWidgets 3.0.2 using Visual Studio 2015
- 求DAG上两点的最短距离
- 读完这100篇论文 就能成大数据高手
- 黑马程序员-------IO流
- android------创建模拟器时不能点CPU/ABI
- Jsp和Servlet的联系与区别
- oracle中函数和存储过程的区别和联系【转载竹沥半夏】
- 高质量C++/C编程指南
- C++中一些概念
- Android0919<二十三>(ViewGroup、Animation、Animator、Layout Animations)
- 朴素贝叶斯分类器
- 重造轮子-栈实现队列
- 使用GIT进行代码管理的心得
- oracle体系结构(1)
- c++(重载、覆盖、隐藏)&&什么情况下,类的析构函数应该声明为虚函数?为什么?
- C#操作excel 报:“不能更新。数据库或对象为只读。”
- linux进程通信--消息队列
- 一看就懂的ReactJs入门教程(精华版)