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

是哪错了呢?(有CODE)

Posted by Azaza at 2005-08-12 18:38:33 on Problem 2555
#include<iostream>
#include<stdio.h>
using namespace std;

typedef struct ice_water{
	double m;
	double c;
}iw;
iw ice,water;
void main()
{
	while(cin>>water.m>>ice.m&&ice.m!=0&&water.m!=0)
	{
		cin>>water.c>>ice.c;
		double ans,wm,im;
		if(water.m*4.19*water.c>ice.m*2.09*(-ice.c)+335*ice.m)
		{
			ans=(4.19*water.c*water.m-2.09*(-ice.c)*ice.m-335*ice.m)/(4.19*(water.m+ice.m));
			wm=water.m+ice.m;
			im=0;
		}
		else if(ice.m*2.09*(-ice.c)>water.m*4.19*water.c+335*water.m)
		{
			ans=-(2.09*(-ice.c)*ice.m-4.19*water.c*water.m-335*water.m)/(2.09*(ice.m+water.m));
			wm=0;
			im=water.m+ice.m;
		}
		else
		{
			ans=0;
			wm=water.m+(4.19*water.m*water.c-2.09*(-ice.c)*ice.m)/335;
			im=water.m+ice.m-wm;
		}
		printf("%.1f g of ice and %.1f g of water at %.1f C\n",im,wm,ans);
	}
}

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