|
|
back to boardCommon BoardSomebody, please help!!! Problem 1134 Posted by beerm2n 25 Apr 2005 23:53 Why wrong answer??? I test many variants and system always give correct answer, but on this page it broken on 1st test. program Project1; {$APPTYPE CONSOLE} uses SysUtils; var a:array[0..1000] of integer; i,n,t,m:integer; label l1; begin read(n); readln(m); while not eof do begin read(t); if t>n then begin write('No'); goto l1; end; inc(a[t]); if a[t]>=3 then begin write('No'); goto l1; end; end; i:=0; if a[n]=2 then begin write('No'); goto l1; end; if a[0]=2 then begin write('No'); goto l1; end; while i<=m do begin if a[0]=1 then begin i:=i+1; while a[i]=1 do i:=i+1; if a[i]=2 then begin write('No'); goto l1; end else i:=i+1; end else if a[i]=2 then begin i:=i+1; while a[i]=1 do i:=i+1; if a[i]=2 then begin write('No'); goto l1; end else i:=i+1; end else if a[i]=1 then begin i:=i+1; while a[i]=1 do i:=i+1; if (a[i]=2) and (a[i+1]=1) then begin write('No'); goto l1; end else i:=i+1; end else i:=i+1; end; write('Yes'); l1: end. Edited by author 26.04.2005 00:51 ++++++++++++++++ First time, clearly! Read out the information from the keyboard!! assign, reset remove. Write number of a problem!! |
|
|