542021-01-09 15:47:37mraronToronyépítés (2,2,3,3)pascalAccepted 40/4010ms8280 KiB
Program torony;
  const maxn=1000000;
        maradek=20210108;
  var n: integer;
      t: array[1..maxn] of integer;
      i: integer;
      
   Function tt(n: integer): integer;
   begin
     if t[n]<0 then
     begin
       if n=1 then t[n]:=0
       else if n=2 then t[n]:=2
       else if n=3 then t[n]:=2
       else t[n]:=(2*tt(n-2)+2*tt(n-3)) mod maradek;
     end;
     tt:=t[n];
   end;
begin
  readln(n);
  for i:=1 to n do t[i]:=-1;
  writeln(tt(n));
end.
SubtaskSumTestVerdictTimeMemory
base40/40
1Accepted0/01ms1124 KiB
2Accepted0/01ms1120 KiB
3Accepted2/21ms1088 KiB
4Accepted2/21ms1088 KiB
5Accepted3/31ms1096 KiB
6Accepted3/31ms1228 KiB
7Accepted3/310ms8280 KiB
8Accepted3/36ms5256 KiB
9Accepted3/31ms1176 KiB
10Accepted3/31ms1248 KiB
11Accepted3/38ms8036 KiB
12Accepted3/38ms7832 KiB
13Accepted4/48ms7300 KiB
14Accepted4/48ms5796 KiB
15Accepted2/21ms1264 KiB
16Accepted2/21ms1136 KiB