Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

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:23 on Problem 2521
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator