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

Re:who can tell me what is wrong for my code?

Posted by atlas_of_rruucc at 2004-07-08 19:35:24 on Problem 1675
In Reply To:who can tell me what is wrong for my code? Posted by:galois_godel at 2004-06-27 16:57:50
浆果可能在原点上~~~~~~~~~~~~
> #include<iostream>
> #include<cstdio>
> #include<cmath>
> #include<cassert>
> using namespace std;
> int x[5],y[5];
> 
> int judge()
> {
> 	int i,j;
> 	
> 	for(i=0;i<3;i++)
> 	{
> 		if(x[i]==0 && y[i]==0)return 0;
> 		
> 	}
> 	for(i=0;i<3;i++)
> 	{
> 		j=(i+1)%3;
> 		int m1=(x[i]*x[j]+y[i]*y[j]);
> 		int m2=(x[i]*y[j]-x[j]*y[i]);
> 		if(m2==0 && m1<0)return 0;
> 	}
> 	
> 	for(i=0;i<3;i++)
> 	{
> 		j=(i+1)%3;
> 		int mul=(x[i]*x[j]+y[i]*y[j]);
> 		if(mul>=0)continue;
> 		mul=mul*mul;
> 		int d1=(x[i]*x[i]+y[i]*y[i]);
> 		int d2=(x[j]*x[j]+y[j]*y[j]);
> 		if(mul*4>d1*d2)return 1;
> 	}
> 	
> 
> 	
> 	
> 	return 0;
> 	
> }
> 
> 
> 		
> int main()
> {
> 	int r;
> 	
> 	int cas;
> 	char temp[100];
> 	scanf("%d",&cas);
> 	while(cas--)
> 	{
> 		scanf("%s",temp);
> 		assert(strlen(temp)<3);
> 		sscanf(temp,"%d",&r);
> 		int i;
> 		for(i=0;i<3;i++)scanf("%d %d",&x[i],&y[i]);
> 		
> 		if(judge())
> 		{
> 			printf("Yes\n");
> 		}
> 		else
> 		{
> 			printf("No\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