markdown 在线制作ppt json校验和格式化工具

POJ 1017

  1 #include<iostream>
  2 #include<stdio.h>
  3 using namespace std;
  4 
  5 int main()
  6 {
  7     //freopen("acm.acm","r",stdin);
  8     int num1,num2,num3,num4,num5,num6;
  9     int sum;
 10     int temp;
 11     int tem;
 12     while(cin>>num1>>num2>>num3>>num4>>num5>>num6)
 13     {
 14         sum = 0;
 15         if(!num1&&!num2&&!num3&&!num4&&!num5&&!num6)
 16             break;
 17         sum += num6;
 18         sum += num5;
 19         if(num5*11 >= num1)
 20             num1 = 0;
 21         else
 22             num1 -= num5*11;
 23         sum += num4;
 24         if(num4*5 >= num2)
 25         {
 26             if((tem =(num4*5 - num2)*4) >= num1)
 27             {
 28                 num1 = 0;
 29             }
 30             else
 31                 num1 -= tem;
 32             num2 = 0;
 33         }
 34         else
 35             num2 -= num4*5;
 36         sum += num3/4;
 37         switch(num3%4)
 38         {
 39         case 0:
 40             break;
 41         case 1:
 42             if(num2 <= 5)
 43             {
 44                 if((tem =(5 - num2)*4) >= num1)
 45                     num1 = 0;
 46                 else 
 47                     num1 -= tem;
 48                 num2 = 0;
 49             }
 50             else
 51             {
 52                 num2 -= 5;
 53             }
 54             if(num1 <= 7)
 55             {
 56                 num1 = 0;
 57             }
 58             else
 59                 num1 -= 7;
 60             ++ sum;
 61             break;
 62         case 2:
 63             if(num2 <= 3)
 64             {
 65                 if((tem = (3 - num2)*4) >= num1)
 66                     num1 = 0;
 67                 else
 68                     num1 -= tem;
 69                 num2 = 0;
 70             }
 71             else
 72             {
 73                 num2 -= 3;
 74             }
 75             if(num1 <= 6)
 76                 num1 = 0;
 77             else
 78                 num1 -= 6;
 79             ++ sum;
 80             break;
 81         case 3:
 82             if(num2 <= 1)
 83             {
 84                 if((tem = (1 - num2)*4) >= num1)
 85                     num1 = 0;
 86                 else
 87                     num1 -= tem;
 88                 num2 = 0;
 89             }
 90             else
 91                 num2 -= 1;
 92             if(num1 <= 5)
 93                 num1 = 0;
 94             else
 95                 num1 -= 5;
 96             ++ sum;
 97             break;
 98         default:break;
 99         }
100         sum += num2/9;
101         sum += (((num2%9)*4+num1) + 35)/36;
102         //if((num2%9)*4 + num1 > 0)
103         //{
104         //    ++ sum;
105         //    if((num2%9)*4 + num1 > 36)
106         //    {
107         //        temp = (num2%9)*4 + num1 - 36;
108         //        sum += (temp+35)/36;
109         //    }
110         //}
111         cout<<sum<<endl;
112     }
113 }

 

 

关注我的公众号,当然,如果你对Java, Scala, Python等技术经验,以及编程日记,感兴趣的话。 

技术网站地址: vmfor.com

posted @ 2015-06-09 13:17  GavinHacker  阅读(180)  评论(0编辑  收藏  举报
markdown 在线制作ppt json校验和格式化工具