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 |
为什么一直wa呀//题目大意,一个公司要么每月盈利s,要么亏损d一年每5个月发一份报告,一年8次,每次报表都显示亏损(1-5,2-6,3-7,4-8,5-9,6-10,7-11,8-12) #include<iostream> using namespace std; int main() { int s,d; int temp; while(cin>>s>>d) { for(int i=4;i>=0;i--) { if(s*i-d*(5-i)<=0) { temp=i;break; } } if(temp==4) { if(10*s-2*d>=0) cout<<10*s-2*d<<endl; else cout<<"Deflict"<<endl; } if(temp==3) { if(8*s-4*d>=0) cout<<8*s-4*d<<endl; else cout<<"Deflict"<<endl; } if(temp==2) { if(6*s-6*d>=0) cout<<6*s-6*d<<endl; else cout<<"Deflict"<<endl; } if(temp==1) { if(3*s-9*d>=0) cout<<3*s-9*d<<endl; else cout<<"Deflict"<<endl; } if(temp==0) { if(d==0) cout<<"0"<<endl; else cout<<"Deflict"<<endl; } } } //所有情况要考虑到 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator