| ||||||||||
| 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 | |||||||||
为什么这样子是WA,求解,谢谢,#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator