【Poj1017】Packets
生活随笔
收集整理的這篇文章主要介紹了
【Poj1017】Packets
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
http://poj.org/problem?id=1017
艱難啊
弄了很久咧
拍了幾十萬組,以后拍要多組數據
Solution
從大wangxiaofang
從大往小放,有空余的從大往小填
注意細節(jié)
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 & minif(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; }
轉載于:https://www.cnblogs.com/YJinpeng/p/5978473.html
總結
以上是生活随笔為你收集整理的【Poj1017】Packets的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: this和static
- 下一篇: svg笔记----------path篇