Clarke and minecraft hdoj 5463 (数学题)
来源:互联网 发布:nginx rewrite 配置 编辑:程序博客网 时间:2024/04/29 16:22
Clarke and minecraft
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 457 Accepted Submission(s): 234
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
12Hint: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;//题意:有一个背包,有36个格子,一个格子可以装64个物品,同一个格子不能装不同的物品,但不同的格子可以装不同的物品。问克拉克将这些物品全移走,一共要跑几趟。#include<stdio.h>#include<string.h>#include<math.h>int a[600];int main(){int t;int n,i,j;int x,y;scanf("%d",&t);while(t--){memset(a,0,sizeof(a));scanf("%d",&n);for(i=0;i<n;i++){scanf("%d %d",&x,&y);a[x]+=y;}int k=0;for(i=0;i<600;i++){if(a[i]){k+=(int)ceil(a[i]*1.0/64);}}printf("%d\n",(int)ceil(k*1.0/36));}return 0;}
0 0
- Clarke and minecraft hdoj 5463 (数学题)
- HDOJ 5463 Clarke and minecraft(贪心向上取整)
- hdoj 5463 Clarke and minecraft 【简单贪心】
- HDOJ 5463-Clarke and minecraft【贪心】
- HDU 5463 Clarke and minecraft(模拟)
- 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【水】
- Clarke and minecraft
- HDU_5463 Clarke and minecraft
- hdu 5463 Clarke and minecraft(BestCoder Round #56 (div.2))
- hdu5463 Clarke and minecraft(BestCoder Round #56 (div.2) )
- hdoj--5562--Clarke and food(模拟)
- 网络请求的封装
- uva 1327 - King's Quest(强联通)
- ubuntu下source、sh、bash、./执行脚本的区别
- 机器学习 之 牛顿法和梯度下降法原理与实现
- Light oj 1119 - Pimp My Ride(状压dp)
- Clarke and minecraft hdoj 5463 (数学题)
- ocp-v13-347
- 全面讲解Tomcat下SSL证书的配置(五)
- hihocoder 1228 Mission Impossible 6
- MySQL 新增用户 权限分配 远程登录
- HDU 5437 Alisha’s Party(优先队列)(2015网络赛长春站)
- NOIP模拟10.27总结
- DP?(数论+组合数学综合题:组合数性质+预处理+组合数取摸)
- HDU 5458(Stability-LCT维护连通图2点间割边个数)