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 |
神啊,救救我吧1000组数据都过了,还是WA啊。我是模拟每一种情况的 先是(6,6),(5,5),(4,4)个数总和加起来 (5,5)用(1,1)配;(4,4)用(2,2)和(1,1)配 (3,3)填不满也和(4,4)一样配,再分别考虑缺1,2,3个(3,3)时,如何用(2,2)和(1,1)填 最后考虑(2,2)和(1,1)。而且之前用(2,2),(1,1)填的时候也计算了他们的剩余个数。 为什么还是不对啊!!!!!!!!!! #include<iostream> int j,k,m,sum; using namespace std; int main() {int a,b,c,d,e,f; while(cin>>a>>b>>c>>d>>e>>f) {if(a||b||c||d||e||f) {sum=0; sum+=f; sum+=e; sum+=d; if(a>(11*e)) {if(e) a=a-(11*e); else a=a;} else a=0; if(b>5*d) {if(d) b=b-(5*d); else b=b;} else { j=(5*d-b)*4; b=0; if(a) {if(a>j) a-=j; else a=0;} else a=0;} if(c%4) {k=(4-c%4)*9; c=c/4+1; if(b) {if(k==27) {if(b>5) {b-=5; k=7;} else {k-=b*4; b=0;}} if(k==18) {if(b>3) {b-=3; k=6;} else {k-=b*4; b=0;}} if(k==9) {if(b>1) {b-=1; k=5;} else {k-=b*4; b=0;}} if(a>k) a-=k; else a=0;} else {if(a>(4-c%4)*9) a-=(4-c%4)*9; else a=0;}} else c=c/4; sum+=c; if(b%9) { m=36-(b%9)*4; b=b/9+1; if(a>m) a-=m; else a=0;} else b=b/9; sum+=b; if(a%36) a=a/36+1; else a/=36; sum+=a; cout<<sum<<endl;} else break;} return 0;} Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator