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

自己编译结果完全对,就是wrong answer

Posted by a459965536 at 2011-03-13 12:37:14 on Problem 3979
#include<stdio.h>
#include<math.h>


void hot(int *a)
{
	int b[2],t,j=1,i;
  if(a[2]!=a[6])
  {  
	  t=a[2];
	  a[2]*=a[6];
	 a[0]*=a[6];
	  a[6]*=t;
	  a[4]*=t;
  }
  if(a[3]!=43)
  {
  b[0]=a[0]-a[4];
  b[1]=a[2];
  }
  else
  {
   b[0]=a[0]+a[4];
  b[1]=a[2];
  }


  for( i=2;i<=abs(b[0]);i++)
  {
	  if(b[0]%i==0&&b[1]%i==0)
		  j=i;
  }
 b[0]/=j;
  b[1]/=j;
		if(b[0]==0||b[0]==b[1])
			printf("%d\n",b[0]/b[1]);
		else
		printf("%d/%d\n",b[0],b[1]);

		


}

int main()
{
	
	int b[7],i;
	char c;
while(EOF != scanf("%d/%d%c%d/%d", &b[0], &b[2], &c, &b[4],&b[6]))
	{
	b[3]=c;

	hot(b);
}
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