Advertisement
Graf_Rav

Untitled

May 17th, 2018
365
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.96 KB | None | 0 0
  1. var n, i, ans, a, ch13, nech13, chN13, nechN13 : integer;
  2. q:array[0..4] of integer;
  3.  
  4. begin
  5.     read(n);
  6.     for i:=0 to 4 do begin
  7.         read(q[i]);
  8.     end;
  9.    
  10.     ans:=0;
  11.     ch13:=0; nech13:=0; chN13:=0; nechN13:=0;
  12.     for i:=5 to n-1 do begin
  13.         read(a);
  14.        
  15.         if(q[0] mod 2=0) then begin
  16.             if(q[0] mod 13=0) then
  17.                 ch13+=1
  18.             else
  19.                 chN13+=1;
  20.         end
  21.         else
  22.             if(q[0] mod 13=0) then
  23.                 nech13+=1
  24.             else
  25.                 nechN13+=1;
  26.        
  27.         if(a mod 2=0) then begin
  28.             if(a mod 13=0) then
  29.                 ans+=nechN13;
  30.             ans+=nech13;
  31.         end
  32.         else begin
  33.             if(a mod 13=0) then
  34.                 ans+=chN13;
  35.             ans+=ch13;
  36.         end;
  37.        
  38.         q[0]:=q[1];
  39.         q[1]:=q[2];
  40.         q[2]:=q[3];
  41.         q[3]:=q[4];
  42.         q[4]:=a;
  43.     end;
  44.    
  45.     write(ans);
  46. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement