HDU 5463 Clarke and minecraft(模拟)
来源:互联网 发布:写一个动态数组模板类 编辑:程序博客网 时间:2024/04/29 17:58
题目地址:点击打开链接
题意:一个人要背一个包把散在地上的材料从A地帮到B地,他的包有36格子,每个格子只能放一种材料,一个格子最多能放64个材料,问他得搬东西从A地到B地几次
思路:把相同的材料放的一块,然后往背包里放就行了,36个格子满了他就得搬一次
AC代码:
#include <iostream>#include <cstdio>#include <cstdlib>#include <algorithm>#include <queue>#include <stack>#include <map>#include <cstring>#include <climits>#include <cmath>using namespace std;int a[510];int main(){ int t,n,i; int kind,num; scanf("%d",&t); while(t--) { memset(a,0,sizeof(a)); scanf("%d",&n); for(i=0; i<n; i++) { scanf("%d%d",&kind,&num); a[kind] += num; } int sum = 0; for(i=1; i<=500; i++) { a[i] % 64 == 0 ? sum += a[i] / 64 : sum += a[i] / 64 + 1; } sum % 36 == 0 ? printf("%d\n",sum/36) : printf("%d\n",sum/36+1); } return 0;}
0 0
- 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 hdoj 5463 (数学题)
- hdu 5463 Clarke and minecraft(BestCoder Round #56 (div.2))
- HDOJ 5463 Clarke and minecraft(贪心向上取整)
- hdoj 5463 Clarke and minecraft 【简单贪心】
- HDOJ 5463-Clarke and minecraft【贪心】
- Clarke and minecraft
- HDU_5463 Clarke and minecraft
- HDU 5625 Clarke and chemistry(模拟)
- HDU 5463 Clarke and minecraft(贪心)——BestCoder Round #56(div.2)
- 一个监听数字加减变化的自定义控件
- Android应用的耗电量统计
- [LeetCode]Ugly Number
- sidekiq 异步处理任务
- HibernateTransactionManager事务管理
- HDU 5463 Clarke and minecraft(模拟)
- 即时战略游戏中实用的寻路算法都有哪些,比较如何?
- matlab uigetfile()的使用
- Effective C++——条款50(第8章)
- Warning: Maximum number of format records exceeded. Using default format.
- js之DOM操作(删除节点removeChild())
- MVC模型优化方案
- 在Mysql 众多表中查找一个表名或者字段名
- 自学Node.js: WebStorm+Node.js开发环境的配置