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:if(p>=m) l=c+n;if(p<m) l=n-m+p; p>=m的时候c不就是p-m吗?为什么就会wa呢?In Reply To:Re:if(p>=m) l=c+n;if(p<m) l=n-m+p; p>=m的时候c不就是p-m吗?为什么就会wa呢? Posted by:ljtszsy at 2006-08-08 17:44:06 > 想得太复杂了吧,其实关系很简单,算出顾客付出的钱pm,算出收到的假钱fm,可以算出老板收到的rm。老板一共损失了是cost+pay=bcm,所以老板损失了bcm-rm。 #include "iostream" using namespace std; int main() { int N,M,P,C; int rm,fm,pm,bcm; while(cin>>N>>M>>P>>C&&N&&M&&P&&C) { pm=M+C; fm=P; rm=pm-fm; bcm=N+C; cout<<bcm-rm<<endl; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator