Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
zad27-optimal
//fpc 3.0.0 program zad27; var x : array [1..30000] of byte; var res : longint; var kchet, knech, kchetdel, knechdel, i : integer; var ischet, isdel : boolean; begin kchet:=0; knech:=0; kchetdel:=0; knechdel:=0; res:=0; for i:=1 to length(x) do begin x[i]:=i; ischet:=(x[i] mod 2) = 0; isdel:=(x[i] mod 3) = 0; if i>1 then begin if ischet then begin if isdel then res:=res+knech else res:=res+knechdel; end else begin if isdel then res:=res+kchet else res:=res+kchetdel; end; end; if ischet then begin kchet:=kchet+1; if isdel then kchetdel:=kchetdel+1; end else begin knech:=knech+1; if isdel then knechdel:=knechdel+1; end; end; writeln('result=',res); end.
run
|
edit
|
history
|
help
0
homework
Tri 1.0
Complemento da VS ICC II - 1º Semestre 2017
zadanye 3 в
nomer8
Greetings
Kotak_Adit
Prosti brojevi praktikum nizovi
nigger
Fibonasi