Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:赞,学习了!!In Reply To:Re:这算法太帅了; Posted by:tiaoer at 2012-04-06 23:51:48 > #include<stdio.h> > int main() > { > int n,a,b,c,d,e,f,x,y; > int u[4]={0,5,3,1}; > while(1) > { > scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f); > if(a==0&&b==0&&c==0&&d==0&&e==0&&f==0) > break; > n=d+e+f+(c+3)/4;//懂了 > y=5*d+u[c%4];//在已有n个的情况下,能装下y个2*2的 > if(b>y) > n+=(b-y+8)/9;//把多的2*2的弄进来 > x=36*n-36*f-25*e-16*d-9*c-4*b; > if(a>x) > n+=(a-x+35)/36;//把1*1的弄进来 > printf("%d\n",n); > } > return 0; > } 学习了! Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator