HDU 5463Clarke and minecraft
来源:互联网 发布:怎么知道淘宝客跟买家 编辑:程序博客网 时间:2024/04/28 10:41
Clarke and minecraft
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 260 Accepted Submission(s): 136
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.
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 numbern , the number of items.
Thenn 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.
For each test case:
The first line contains a number
Then
Output
For each testcase, print a number, the number of times that Clarke need to transport at least.
Sample Input
232 333 332 33105 4676 3787 3098 4995 3203 4802 4448 3915 333100 499
Sample Output
12
水题,有一个背包有36个格子 每个格子只能放一种物品,且最多只能叠加64个 问要多少次才能将物品运完
#include <iostream>#include <cstdio>#include <cstring>#include <stack>#include <queue>#include <map>#include <set>#include <vector>#include <cmath>#include <algorithm>using namespace std;int a[505];void add(){ int sum=0,t=0; for(int i=1;i<=500;i++) { if(a[i]) { sum+=a[i]/64; if(a[i]%64) sum++; while(sum>=36) t++,sum-=36; } } if(sum) t++; cout<<t<<endl;}int main(){ int t; cin>>t; while(t--) { int n; cin>>n; memset(a,0,sizeof(a)); for(int i=0;i<n;i++) { int s,t; cin>>s>>t; a[s]+=t; } add(); }}
0 0
- HDU 5463 Clarke and minecraft
- HDU 5463 Clarke and minecraft
- HDU 5463 Clarke and minecraft
- HDU 5463Clarke and minecraft
- HDU-5463Clarke and minecraft
- hdu 5463 Clarke and minecraft
- HDU 5463 Clarke and minecraft(模拟)
- hdu 5463 Clarke and minecraft(水)
- Hdu 5463 Clarke and minecraft【水】
- Clarke and minecraft hdoj 5463 (数学题)
- hdoj 5463 Clarke and minecraft 【简单贪心】
- HDOJ 5463-Clarke and minecraft【贪心】
- Clarke and minecraft
- HDU_5463 Clarke and minecraft
- HDU 5463 Clarke and minecraft(贪心)——BestCoder Round #56(div.2)
- hdu 5463 Clarke and minecraft(BestCoder Round #56 (div.2))
- HDOJ 5463 Clarke and minecraft(贪心向上取整)
- HDU Clarke and points
- Ubuntu12.04下hadoop-2.6.0单机配置和伪分布式配置
- js == 和 ===
- <climits>头文件
- 杰帝电影收藏
- 读书笔记之《程序员的自我修养——链接、装载与库》
- HDU 5463Clarke and minecraft
- testlink的操作过程
- 获取SD卡的剩余容量
- Android轻量级ORM框架ActiveAndroid入门教程(转)
- 杭电2212DFS
- 【Oracle】day05_视图_序列_索引_约束
- MySQL数据库
- python获取对象信息type、dir、getattr、setattr
- String的常用方法总结