zoukankan      html  css  js  c++  java
  • POJ 1017: Packets

    #include <iostream>
    #include <string>
    #include <cstdio>
    #include <cmath>
    #include <cstring>
    #include <algorithm>
    #include <vector>
    #include <queue>
    #include <deque>
    #include <map>
    #define range(i,a,b) for(int i=a;i<=b;++i)
    #define LL long long
    #define rerange(i,a,b) for(int i=a;i>=b;--i)
    #define fill(arr,tmp) memset(arr,tmp,sizeof(arr))
    using namespace std;
    int num[]={0,5,3,1},pro[6];
    void init(){
    
    }
    void solve(){
        while(true){
            bool flag=false;
            range(i,0,5){
                cin>>pro[i];
                if(pro[i]>0)flag=true;
            }
            if(!flag)break;
            int pack=pro[5]+pro[4]+pro[3]+(pro[2]+3)/4;
            int twos=pro[3]*5+num[pro[2]%4];
            if(pro[1]>twos)pack+=(pro[1]-twos+8)/9;
            int ones=36*pack-36*pro[5]-25*pro[4]-16*pro[3]-9*pro[2]-4*pro[1];
            if(pro[0]>ones)pack+=(pro[0]-ones+35)/36;
            cout<<pack<<endl;
        }
    }
    int main() {
        init();
        solve();
        return 0;
    }
    View Code
  • 相关阅读:
    如何讓你的程序在退出的時候執行一段代碼?
    05_Python爬蟲入門遇到的坑__總結
    04_Python爬蟲入門遇到的坑__向搜索引擎提交關鍵字02
    03_Python爬蟲入門遇到的坑__向搜索引擎提交關鍵字01
    02_Python爬蟲入門遇到的坑__反爬蟲策略02
    01_Python爬蟲入門遇到的坑__反爬蟲策略01
    Python爬蟲--rrequests庫的基本使用方法
    C#筆記00--最基礎的知識
    為元組中的每一個元素命名
    Filter函數
  • 原文地址:https://www.cnblogs.com/Rhythm-/p/9339066.html
Copyright © 2011-2022 走看看