【Poj1017】Packets
2024-08-23 13:17:21
http://poj.org/problem?id=1017
艰难啊
弄了很久咧
拍了几十万组,以后拍要多组数据
Solution
从大wangxiaofang
从大往小放,有空余的从大往小填
注意细节
Notice
b<0的情况,还有就是当前填充完了,还剩一点给下一个(小一点的)填
Code
// This file is made by YJinpeng,created by XuYike's black technology automatically.
// Copyright (C) 2016 ChangJun High School, Inc.
// I don't know what this program is. #include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#define MOD 1000000007
#define INF 1e9
using namespace std;
typedef long long LL;
const int MAXN=100010;
const int MAXM=100010;
inline int gi() {
register int w=0,q=0;register char ch=getchar();
while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
if(ch=='-')q=1,ch=getchar();
while(ch>='0'&&ch<='9')w=w*10+ch-'0',ch=getchar();
return q?-w:w;
}
int main()
{
freopen("1017.in","r",stdin);
freopen("1017.out","w",stdout);
int ans,a,b,c,d,e,f,x;
while(a=gi(),b=gi(),c=gi(),d=gi(),e=gi(),f=gi(),a||b||c||d||e||f){
ans=d+e+f;if(c)ans+=(c-1)/4+1;
if(d*5>b)a-=(d*5-b)*4;
a-=11*e;b-=d*5;x=(4-c%4)*2-1;
if(c%4!=0)a-=(4-c%4)*9-min(x,(b<0?0:b))*4;
//this b<0 & min
if(c%4!=0)b-=x;if(b>0)ans+=(b-1)/9+1;
if(b>0&&b%9!=0)a-=(9-b%9)*4;
if(a>0)ans+=(a-1)/36+1;
printf("%d\n",ans);
}
return 0;
}
最新文章
- centos下开启ftp服务
- 【DFS】POJ 1321
- 161226、js日期格式化
- 解决编译apache出现的问题:configure: error: APR not found . Please read the documentation
- 初学hibernate之缓存
- javascript栈的建立样码
- 微信支付开发(12) 认清微信支付v2和v3
- session StateServer 方式 初始化StateServer服务器
- HDU 1385 Minimum Transport Cost (Dijstra 最短路)
- socket编程中用到的头文件整理
- NSData的一些用法
- Nightmare(BFS)
- javascript高级知识分析——作为对象的函数
- SQL Server 完成性检查的顺序
- EasyMock入门
- JetBrain系列IDE提示Filesystem Case-Sensitivity Mismatch的解决
- Eclipse + Pydev问题 : pydev unresolved import
- STA分析(二) multi_cycle and false
- centos7 docker 安装showdoc
- 关闭IE 对剪切板访问的提示
热门文章
- 零基础入门学习Python(14)--字符串:各种奇葩的内置方法
- 源码学习-String类
- (十二)python3 迭代器
- 【已解决】ERROR: bootstrap checks failed memory locking requested for elasticsearch process but memory is not locked
- 常见问题:Linux安装Python3步骤、Windows无法利用pip
- 一练Splay之维修数列第一次
- js数组转换成json串 (JSON.stringify)
- hiho一下 第五十周 (求欧拉路径)
- SOJ 2749_The Fewest Coins
- Delphi DBGrid实现多选