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 |
why WA (code Pascal) Help 1410 !!!!!!!program p1410; type point=record x,y:integer; end; line=array[1..2]of point; var n:integer; lin:line; rect:array[1..4]of point; procedure init; begin read(lin[1].x,lin[1].y,lin[2].x,lin[2].y); read(rect[1].x,rect[1].y,rect[3].x,rect[3].y); rect[2].x:=rect[1].x; rect[2].y:=rect[3].y; rect[4].x:=rect[3].x; rect[4].y:=rect[1].y; end; function Notsame(l:line;a,b:point):boolean; var dx,dy,dx1,dy1,dx2,dy2:integer; begin dx:=l[2].x-l[1].x; dy:=l[2].y-l[1].y; dx1:=a.x-l[1].x; dy1:=a.y-l[1].y; dx2:=b.x-l[1].x; dy2:=b.y-l[1].y; Notsame:=(dy*dx1-dx*dy1)*(dy*dx2-dx*dy2)<=0 ; end; procedure main; var TF:boolean; begin TF:=false; TF:=TF or notsame(lin,rect[1],rect[2]); TF:=TF or notsame(lin,rect[2],rect[3]); TF:=TF or notsame(lin,rect[3],rect[4]); TF:=TF or notsame(lin,rect[4],rect[1]); if TF then writeln('T') else writeln('F') end; begin readln(n); repeat init; main; dec(n); until n=0; end. Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator