码迷,mamicode.com
首页 > 其他好文 > 详细

POJ 10107

时间:2018-09-28 01:28:49      阅读:210      评论:0      收藏:0      [点我收藏+]

标签:[]   span   namespace   cstring   while   bsp   har   printf   poj   

有一点帅,存一下。

 1 #include <iostream>
 2 #include <cstdio>
 3 #include <cmath>
 4 #include <cstring>
 5 #include <algorithm>
 6 #include <queue>
 7 #include <stack>
 8 #include <vector>
 9 using namespace std;
10 int main(int argc, char *argv[])
11 {
12     int n,a,b,c,d,e,f,x,y;
13     int u[4]={0,5,3,1};
14     while(1)
15     {
16         scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f);
17         if(a==0&&b==0&&c==0&&d==0&&e==0&&f==0)
18             break;
19         n=d+e+f+(c+3)/4;//懂了
20         y=5*d+u[c%4];//在已有n个的情况下,能装下y个2*2的
21         if(b>y)
22             n+=(b-y+8)/9;//把多的2*2的弄进来
23         x=36*n-36*f-25*e-16*d-9*c-4*b;
24         if(a>x)
25             n+=(a-x+35)/36;//把1*1的弄进来
26         printf("%d\n",n);
27     }
28     return 0;
29 }

 

POJ 10107

标签:[]   span   namespace   cstring   while   bsp   har   printf   poj   

原文地址:https://www.cnblogs.com/huluxin/p/9716313.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!