Question:http://poj.org/problem?id=1017
问题点:贪心。
 Memory: 224K        Time: 32MS
Language: C++ Result: Accepted #include <iostream>
using namespace std; int seq[]={,,,};//表示分配完3*3产品剩余3*3产品数对应剩余2*2的空位数
int main()
{
int product[],packets,twos,ones;
bool flag;
while(true)
{
int i;
flag=false;
for(i=;i<;i++)
{
cin>>product[i];
if(product[i]>) flag=true;
}
if(!flag) break; packets = product[]+product[]+product[]+(product[]+)/;
twos = product[]*+seq[product[]%];
if(product[]>twos)
{
packets += (product[]-twos+)/;
}
ones = *packets-*product[]-*product[]-*product[]-*product[]-*product[];
if(product[]>ones)
{
packets += (product[]-ones+)/;
}
cout<<packets<<endl;
}
return ;
}

北大ACM(POJ1017-Packets)的更多相关文章

  1. 北大ACM - POJ试题分类(转自EXP)

    北大ACM - POJ试题分类 -- By EXP 2017-12-03 转载请注明出处: by EXP http://exp-blog.com/2018/06/28/pid-38/ 相关推荐文: 旧 ...

  2. 北大 ACM 分类 汇总

    1.搜索 //回溯 2.DP(动态规划) 3.贪心 北大ACM题分类2009-01-27 1 4.图论 //Dijkstra.最小生成树.网络流 5.数论 //解模线性方程 6.计算几何 //凸壳.同 ...

  3. 北大ACM题库习题分类与简介(转载)

    在百度文库上找到的,不知是哪位大牛整理的,真的很不错! zz题 目分类 Posted by fishhead at 2007-01-13 12:44:58.0 -------------------- ...

  4. POJ1017 packets

    Packets Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 48911   Accepted: 16570 Descrip ...

  5. 北大ACM试题分类+部分解题报告链接

    转载请注明出处:優YoU http://blog.csdn.net/lyy289065406/article/details/6642573 部分解题报告添加新内容,除了原有的"大致题意&q ...

  6. 北大ACM - POJ试题分类

    1.入门水题 可用于练手与增强自信 POJ-1003POJ-1004 POJ-1005 POJ-1207 POJ-3299 POJ-2159 POJ-1083POJ-3094 2.初级 2.1. 基本 ...

  7. poj-1017 Packets (贪心)

    http://poj.org/problem?id=1017 工厂生产高度都为h,长和宽分别是1×1 2×2 3×3 4×4 5×5 6×6的6种规格的方形物品,交给顾客的时候需要包装,包装盒长宽高都 ...

  8. 北大ACM(POJ1014-Dividing)

    Question:http://poj.org/problem?id=1014 问题点:抽屉原理.dfs.多重背包. Memory: 248K Time: 16MS Language: C++ Res ...

  9. 北大ACM(POJ1013-Counterfeit Dollar)

    Question:http://poj.org/problem?id=1013 问题点:排除+验证. Memory: 244K Time: 16MS Language: C++ Result: Acc ...

随机推荐

  1. Centos7最小安装下Install Clamav(2017-06-09最后更新)

    If you are installing ClamAV for the first time, you have to add a new user and group to your system ...

  2. Cookie对象的特点

    1.存储少量不重要的数据2.存储在客户端的文本文件中(必须设置有效期,否则不被存储)3.安全性差4.存储的数据类型--字符串5.浏览器窗口无关,但与访问的站点相关6.具体特定的过期时间和日期7.在客户 ...

  3. cocos2dx-3.0(21) 移植android平台 说多了都是泪

    ----我的生活,我的点点滴滴! ! 网上3.0的教程真心少.能够说没有吧,大多都是2.x 或者 3.0測试版之类的,因为我心大,没有照着2.x去搞,后来搞完后总结了一下,发觉事实上3.0的移植and ...

  4. LintCode 近期公共祖先

    中等 近期公共祖先 查看执行结果 34% 通过 给定一棵二叉树,找到两个节点的近期公共父节点(LCA). 近期公共祖先是两个节点的公共的祖先节点且具有最大深度. 您在真实的面试中是否遇到过这个题? Y ...

  5. javaweb_page指令

    jsp指令: 1.作用:jsp指令是为jsp引擎设计的.他们并不直接产生不论什么课件输出.而是告诉引擎怎样处理jsp页面中的其余部分 2.jsp指令包含:page指令.include指令,taglib ...

  6. APICloud平台的融云2.0集成

    融云2.0的官方文档地址:http://docs.apicloud.com/端API/开放SDK/rongCloud2 项目须要IM模块,最后还是选择了融云.在iOS原生开发中,融云sdk集成了聊天界 ...

  7. CF#315 C

    #include <cstdio> #include <iostream> #include <algorithm> #include <queue> ...

  8. 后台发送http请求通用方法,包括get和post

    package com.examsafety.service.sh; import java.io.BufferedReader; import java.io.IOException; import ...

  9. BZOJ 1037: [ZJOI2008]生日聚会Party 四维DP

    1037: [ZJOI2008]生日聚会Party Time Limit: 10 Sec  Memory Limit: 162 MBSubmit: 1650  Solved: 971[Submit][ ...

  10. 网关 192.168.2.1 114.114.114.114 dns查询

    在浏览器输入域名 分析抓包数据 分析 ip 192.168.3.123 网关192.168.2.1