PersonalCorpus 版 (精华区)
904063 2002/06/15 05:14:16.023
Big Guava ... 311 C++ Accepted 0:00.010 64
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <stdio.h>
void main()
{
#ifndef ONLINE_JUDGE
freopen("c:\\uva\\input311.txt","r",stdin);
freopen("c:\\uva\\output311.txt","w",stdout);
#endif
int a,b,c,d,e,f;
int tot;
scanf("%d%d%d%d%d%d\n",&a,&b,&c,&d,&e,&f);
while ((a!=0)||(b!=0)||(c!=0)||(d!=0)||(e!=0)||(f!=0)) {
// 6
tot=f;
// 5
tot+=e;
a-=e*(36-25);
// 4
tot+=d;
b-=d*5;
if (b<0) { a+=b*4; b=0; }
// 3
tot+=c/4;
c%=4;
if (c!=0) {
tot++;
switch (c) {
case 1 : b-=5; a-=7; break;
case 2 : b-=3; a-=6; break;
case 3 : b-=1; a-=5; break;
}
if (b<0) { a+=b*4;b=0; }
}
// 2
tot+=b/9;
b%=9;
if (b!=0) {
tot++;
a-=36-b*4;
}
// 1
if (a>0) {
tot+=a/36;
a%=36;
if (a>0) tot++;
}
printf("%d\n",tot);
scanf("%d%d%d%d%d%d\n",&a,&b,&c,&d,&e,&f);
}
}
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.754毫秒