poj 2521(水题,注意真币数是m+c-p(不是c也不是m-p),所以亏损:n+c-(m+c-p);)
#include<iostream> #include<cstdio> using namespace std; int main(){ int n,m,p,c; while(scanf("%d%d%d%d",&n,&m,&p,&c)==4&&n)//真币数:m+c-p,亏损:n+c-(m+c-p) printf("%d\n",n-m+p); return 0; }
#include<iostream> #include<cstdio> using namespace std; int main(){ int n,m,p,c; while(scanf("%d%d%d%d",&n,&m,&p,&c)==4&&n)//真币数:m+c-p,亏损:n+c-(m+c-p) printf("%d\n",n-m+p); return 0; }