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;

题意:有一个背包有36个格子  每个格子只能放一种物品,且最多只能放64个  问要多少次才能将物品运完

#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <time.h>
using namespace std;
typedef long long ll; int p[1000];
const int inf = 0x3f3f3f3f;
int main()
{
int T,n,a,b;
scanf("%d",&T);
while(T--)
{
scanf("%d",&n);
memset(p,0,sizeof(p));
int tmax = 0;
for(int i = 1;i <= n;i++)
{
scanf("%d%d",&a,&b);
p[a] += b;
if(tmax < a)
tmax = a;
}
int ans = 0;
for(int i = 1;i <= tmax;i++)
{
if(p[i])
{
ans += p[i]/64;
if(p[i] % 64)
ans++;
}
}
if(ans % 36)
printf("%d\n",ans/36 + 1);
else
printf("%d\n",ans/36);
}
return 0;
}

  

hdu 5463(水水)的更多相关文章

  1. hdu 5463 Clarke and minecraft

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5463 Clarke and minecraft Time Limit: 2000/1000 MS (J ...

  2. hdu 5463 Clarke and minecraft(贪心)

    Problem Description Clarke is a patient with multiple personality disorder. One day, Clarke turned i ...

  3. HDU 5463

    题意:一个盒子有36个格子.每个格子可以装64个物品,搬运一个箱子是一次搬运,问最少到搬运次数 思路:直接求总需要多少个格子,然后去求盒子,这里求盒子呢有个小技巧,就是用ceil函数 #include ...

  4. 2013腾讯编程马拉松||HDU 4505 小Q系列故事——电梯里的爱情 水水水

    http://acm.hdu.edu.cn/showproblem.php?pid=4505 题目大意: 电梯最开始在0层,并且最后必须再回到0层才算一趟任务结束.假设在开始的时候已知电梯内的每个人要 ...

  5. HDU 3605

    http://acm.hdu.edu.cn/showproblem.php?pid=3605 用最大流做的,G++超时,C++可以过,看别人写的叫二分图多重匹配,还不会这玩意一会学学 显然的最大流模型 ...

  6. HDU 2503 a/b + c/d(最大公约数与最小公倍数,板子题)

    话不多说,日常一水题,水水更健康!┗|`O′|┛ 嗷~~ a/b + c/d Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768 ...

  7. HDU 1840 Equations (简单数学 + 水题)(Java版)

    Equations 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1840 ——每天在线,欢迎留言谈论. 题目大意: 给你一个一元二次方程组,a(X^2 ...

  8. 悼念512汶川大地震遇难同胞——老人是真饿了 hdu 2187

    在此对 曾经 努力参加 救援的人 致以深深的敬意 . 这一道题 挺简单的 就是简单的  结构体+贪心 而已 不过 用英文 注释  是一个 很大的 进步 ,  以后 要习惯 http://acm.hdu ...

  9. HDOJ 2111. Saving HDU 贪心 结构体排序

    Saving HDU Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total ...

随机推荐

  1. socket_sever实现多客户端并发

    #!/usr/bin/env python # -*- coding:utf-8 -*- import socketserver class mysever(socketserver.BaseRequ ...

  2. hi-nginx-1.4.2发布,多项重要更新

    支持多种编程语言混合开发web应用的通用服务器hi-nginx-1.4.2已经发布了. 此次发布包含多项重要更新: 支持python2和3,通过编译选项--with-http-hi-python-ve ...

  3. git(一)快速入门

    1.设置用户名 git config --global user.name '你的用户名' ​ 2.设置用户名邮箱 git config --global user.email '你的邮箱' ​ 3. ...

  4. D的下L

    D的小L 时间限制:4000 ms  |  内存限制:65535 KB 难度:2   描述       一天TC的匡匡找ACM的小L玩三国杀,但是这会小L忙着哩,不想和匡匡玩但又怕匡匡生气,这时小L给 ...

  5. Linux环境下发布.net core

    一.安装Linux环境 1. 安装VM虚拟机和操作系统 VM虚拟工具安装的过程详见:http://blog.csdn.net/stpeace/article/details/78598333.直接按照 ...

  6. JAVA_SE基础——63.String类的常用方法

    获取方法int length()  获取字符串的长度char charAt(int index) 获取特定位置的字符 (角标越界)int indexOf(String str) 查找子串第一次出现的索 ...

  7. kali rolling更新源之gpg和dirmngr问题

    1.编辑 /etc/apt/source.list gedit /etc/apt/sources.list 输入更新源,可以选任何可用更新源,这里设置官方源 deb http://http.kali. ...

  8. LeetCode & Q217-Contains Duplicate-Easy

    Array Hash Table Description: Given an array of integers, find if the array contains any duplicates. ...

  9. 数据库 MYSQL操作(一)

    数据库  MYSQL操作总结(一) 本文主要介绍一下笔者在使用数据库操作的过程中的一些总结,主要的内容包括一下几个内容: 一.mysql 使用基础(主要包括数据库的安装.基本操作等内容) 二.mysq ...

  10. Mego开发文档 - 复杂查询

    复杂查询 Mego 还支持一些更高级的LLINQ查询写法,本文只列出一部分. 分组汇总查询 using (var db = new OrderManageEntities()) { var query ...