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

为什么这样子是WA,求解,谢谢,

Posted by cnhuangxf at 2011-04-25 20:31:41 on Problem 1914
#include <stdio.h>

__int64 s[3][4];

int main()
{
	int i,j,n;
	__int64 a1,a2,a3,a;
	double x1,x2,x3;
	
	scanf("%d",&n);
	{
		while(n--)
		{
			for(i=0;i<3;i++)
			{
				for(j=0;j<4;j++)
				{
					scanf("%I64d",&s[i][j]);
				}
			}
			a =  s[0][0]*(s[1][1]*s[2][2]-s[1][2]*s[2][1])-
				s[0][1]*(s[1][0]*s[2][2]-s[1][2]*s[2][0])+
				s[0][2]*(s[1][0]*s[2][1]-s[1][1]*s[2][0]);
			
			a1 = s[0][3]*(s[1][1]*s[2][2]-s[1][2]*s[2][1])-
				s[0][1]*(s[1][3]*s[2][2]-s[1][2]*s[2][3])+
				s[0][2]*(s[1][3]*s[2][1]-s[1][1]*s[2][3]);
			
			a2 = s[0][0]*(s[1][3]*s[2][2]-s[1][2]*s[2][3])-
				s[0][3]*(s[1][0]*s[2][2]-s[1][2]*s[2][0])+
				s[0][2]*(s[1][0]*s[2][3]-s[1][3]*s[2][0]);
			
			a3 = s[0][0]*(s[1][1]*s[2][3]-s[1][3]*s[2][0])-
				s[0][1]*(s[1][0]*s[2][3]-s[1][3]*s[2][0])+
				s[0][3]*(s[1][0]*s[2][1]-s[1][1]*s[2][0]);
			printf("%I64d %I64d %I64d %I64d\n",a1,a2,a3,a);
			if(a==0)
			{
				printf("No unique solution\n");
			}
			else
			{
				x1 = (double)a1/(double)a;
				if(x1>-0.0005&&x1<0.0005)
					x1 = 0.000;
				x2 = (double)a2/(double)a;
				if(x2>-0.0005&&x2<0.0005)
					x2 = 0.000;
				x3 = (double)a3/(double)a;
				if(x3>-0.0005&&x3<0.0005)
					x3= 0.000;
				printf("Unique solution: ");
				printf("%.3lf %.3lf %.3lf\n",x1,x2,x3);			
			}
			printf("\n");			
		}
	}
	
	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