题意:一个盒子有36个格子、每个格子可以装64个物品,搬运一个箱子是一次搬运,问最少到搬运次数

思路:直接求总需要多少个格子,然后去求盒子,这里求盒子呢有个小技巧,就是用ceil函数

 #include<iostream>
#include<cmath>
#include<cstring>
using namespace std;
int num[];
int main()
{
int t;cin >> t;
while(t--)
{
int n;cin >> n;
memset(num,,sizeof(num)); //每次需要清零 、
int mmax;
mmax=;
for(int i=;i<n;++i){
int a,b;cin >> a >> b;
num[a]+=b; //统计每一个种类的总数、
if(a>mmax) mmax=a; //记录最大的种类数字 、
}
int tot=;
for(int i=;i<=mmax;++i){
if(num[i]!=)
tot+=ceil(1.0*num[i]/);
}
cout << ceil(1.0*tot/) << endl;
}
}

ceil函数包含在头文件“cmath”,ceil(),括号里面要是实数,求是的大于等于这个实数的最大整数,很多想这类种类问题都可以用ceil函数来求解

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(水水)

    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   S ...

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

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

  5. 【HDU 3037】Saving Beans Lucas定理模板

    http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...

  6. hdu 4859 海岸线 Bestcoder Round 1

    http://acm.hdu.edu.cn/showproblem.php?pid=4859 题目大意: 在一个矩形周围都是海,这个矩形中有陆地,深海和浅海.浅海是可以填成陆地的. 求最多有多少条方格 ...

  7. HDU 4569 Special equations(取模)

    Special equations Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u S ...

  8. HDU 4006The kth great number(K大数 +小顶堆)

    The kth great number Time Limit:1000MS     Memory Limit:65768KB     64bit IO Format:%I64d & %I64 ...

  9. HDU 1796How many integers can you find(容斥原理)

    How many integers can you find Time Limit:5000MS     Memory Limit:32768KB     64bit IO Format:%I64d ...

随机推荐

  1. JS---案例:手风琴 (利用封装好的动画函数)

    案例:手风琴     封装好的动画函数在common.js里面     //function getStyle(element, attr) {...}     //function animate( ...

  2. spring拦截器Interceptor

    在Spring Boot中,拦截器可以分为两种类型: 一是WebMVC,负责拦截请求,类似于过滤器,对用户的请求在Controller接收前进行处理,在Controller处理完成后加工结果等.使用时 ...

  3. mysql各个引擎区别

    1.如果你有一个 MyISAM 数据表包含着 FULLTEXT 或 SPATIAL 索引,你将不能把它转换为使用 另一种引擎,因为只有 MyISAM 支持这两种索引. 2. 如果你有一个数据表包含着一 ...

  4. Leetcode766.Toeplitz Matrix托普利茨矩阵

    如果一个矩阵的每一方向由左上到右下的对角线上具有相同元素,那么这个矩阵是托普利茨矩阵. 给定一个 M x N 的矩阵,当且仅当它是托普利茨矩阵时返回 True. 示例 1: 输入: matrix = ...

  5. RapidMiner Studio 入门

    http://docs.rapidminer.com/studio/getting-started/ RapidMiner Studio 入门 FEIFEI MA 2015-12-07RAPIDMIN ...

  6. 链表源代码(C语言实现)

    源代码(C语言实现) ①.构造链表节点 typedef struct Node    //一个单独的节点                   {                         int ...

  7. IntelliJ Idea 复制粘贴的问题

    分析 尝试从外部复制内容向Idea工作空间内粘贴文件时,有一定的几率会发生复制粘贴失败的问题:复制了新的内容,粘贴的却还是早些时候复制的旧的内容. 我使用的IDEA是最新版(2016.1.3),操作系 ...

  8. Directx11教程(60) tessellation学习(2)

    原文:Directx11教程(60) tessellation学习(2)        本教程中,我们开始tessellation编程,共实现了2个程序,第一个tessellation程序,是对一个三 ...

  9. 反射技术的入口 获取类的Class信息

    package com.sxt.reflect; import com.sxt.reflect.entity.Student; /* * 获取类的Class信息 */ public class Tes ...

  10. apache服务器配置防盗链(centos7)

    <Directory /data/wwwroot/xwl.com> SetEnvIfNoCase Referer "^$" local_ref SetEnvIfNoCa ...