那位高手帮我将这个pascal程序翻译成C
program ss;var
v:array[1..100] of longint;
s,f,i,j:longint;
begin
assign(input,'game.in');reset(input);
assign(output,'game.out');rewrite(output);
readln(s, f);
if (f=4)or(f=7) then
begin
dec(f);
for i:=1 to s do read(v[s-i+1]);
end else
for i:=1 to s do read(v[i]);
j:= 0;
case f of
1: begin
j:=s;
for i:=1 to s-3 do
if (v[i]=v[i+1])and(v[i]=v[i+2])and(v[i]=v[i+3]) then inc(j);
end;
2: begin
for i:=1 to s-1 do
if v[i]=v[i+1] then inc(j);
end;
3: begin
for i:=1 to s-1 do
if v[i]=v[i+1]+1 then inc(j);
for i:=1 to s-2 do
if (v[i]=v[i+1])and(v[i]=v[i+2]-1) then inc(j);
end;
5: begin
for i:=1 to s-2 do
if ((v[i]-v[i+1]=1)or(v[i]-v[i+1]=0))and(v[i]=v[i+2]) then inc(j);
for i:=1 to s-1 do
if abs(v[i]-v[i+1])=1 then inc(j);
end;
6: begin
for i:=1 to s-2 do
if (v[i+1]=v[i+2])and((v[i+1]-v[i]=1)or(v[i+1]-v[i]=0)) then inc(j);
for i:=1 to s-1 do
if (v[i]=v[i+1])or(v[i]=v[i+1]+2) then inc(j);
end;
end;
writeln(j);
close(input);
close(output);
end.