Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Количество пар кр и не кр 11 оптимизированное с логикой
//fpc 3.0.0 program HelloWorld; const delta = 1; var n, i, s, s11, sn, x : integer; m : array [0..delta] of integer; begin s := 0; s11 := 0; sn := 0; readln (n); for i := 0 to delta do begin readln (x); m[i] := x end; for i := delta + 1 to n - 1 do begin readln (x); if (m[0] mod 11 = 0) and (x mod 11 = 0) then begin s11 := s11 + 1; s := s + s11 + sn end else if (m[0] mod 11 <> 0) and (x mod 11 = 0) then begin sn := sn + 1; s := s + s11 + sn end else if (m[0] mod 11 = 0) and (x mod 11 <> 0) then begin s11 := s11 + 1; s := s + s11 end else if (m[0] mod 11 <> 0) and (x mod 11 <> 0) then begin sn := sn + 1; s := s + s11 end; { if m[0] mod 11 = 0 then s11 := s11 + 1 else sn := sn + 1; readln (x); if x mod 11 = 0 then s := s + s11 + sn else s := s + s11; } m[0] := m[1]; m[1] := x; end; writeln(s); end.
run
|
edit
|
history
|
help
0
Урок 3, задача 10 (1483). Два момента времени
nomer6
ahoj
6
Zadanie 3 б
h5534
Tri1
ariketa 05
practica 7 ejercicio B3
jose messias de oliveira 600623130