POJ-1017

#include<stdio.h>

main()
{
      int packets[7] = {0};
      int i, j, num, area;
      while (scanf("%d%d%d%d%d%d", &packets[1], &packets[2], &packets[3], &packets[4], &packets[5], &packets[6]), 
            packets[1]||packets[2]||packets[3]||packets[4]||packets[5]||packets[6]){
            num = packets[6] + packets[5] + packets[4] + (packets[3]+3)/4;
            if (packets[3]%4) {
               packets[2] -=7-2*(packets[3]%4);
               packets[1] -=8-packets[3]%4;
            }
            packets[2] -= packets[4]*5;
            packets[1] -= packets[5]*11;
            if (packets[2]>=0) {
               num+= (packets[2]+8)/9;
               if (packets[2]%9)
               packets[1] -=(9 - packets[2]%9)*4;
            }
            else
                packets[1] += packets[2]*4;
            if (packets[1]>0)
               num += (packets[1]+35)/36;
            printf("%d\n", num);           
      }
}

你可能感兴趣的:(POJ-1017)