|
|
вернуться в форумwrang SOS.HELPPPPPPP program Project1; {$APPTYPE CONSOLE} uses SysUtils; Var N : Integer; C : Array[0..1500] of Char; A : Array[0..1500] of Integer; S : Array[1..10] of String[255]; Total : Longint; xn:boolean; Procedure Main(X : Integer); Var i,j : Longint; Begin If XN then Begin For i := 1 to N+1 do If (Total-(A[X]-A[i])-(A[i]-A[i-1])*i) Mod (N+1)=0 then Begin For j := 1 to i-1 do Write(C[j]); For j := i+1 to X do Write(C[j]); Writeln; Exit; End; End; If X=N then Begin If Total Mod (N+1)=0 then Begin For j := 1 to N do Write(C[j]); Writeln; Exit; End; For i := 1 to X do If C[i]='1' then If (Total-i) Mod (N+1)=0 then Begin C[i] := '0'; For j := 1 to X do Write(C[j]); Writeln; Exit; End; End; End; Procedure Init; Var i,j,k,l : Longint; BB : Boolean; Long : Byte; Begin Readln(N); Long := (N+1) Div 255; If (N+1) mod 255<>0 then Inc(Long); Repeat Fillchar(S,Sizeof(S),0); For i := 1 to Long do Read(S[i]); If Pos('0',S[1])=0 then If Pos('1',S[1])=0 then Break; Readln; j := 0; Fillchar(A,Sizeof(A),0); Total := 0; For i := 1 to Long do For k := 1 to Length(S[i]) do Begin If S[i][k] in ['0','1'] then Begin Inc(j); A[j] := A[j-1]+Ord(S[i][k])-48; Inc(Total,(Ord(S[i][k])-48)*j); C[j] := S[i][k]; End; End; Main(j); Until Eof; End; Begin Init; End. |
|
|