老wa错在哪里

program asddd;
var a, ans:array[0..100000]of longint; i, n, p, sump:longint;
b:array[0..100000, 0..2]of longint;
sum:array[0..2]of int64;
procedure go1;
var i:integer;
begin
ans[n-1]:=sump-sum[1];
ans[n-2]:=sump-sum[0]+b[p, 0];
ans[0]:=sump-sum[2];
for i:=n-3 downto 1 do
ans[i]:=a[i+1]-ans[i+1]-ans[i+2];
for i:=0 to n-1 do write(ans[i], ' ');
readln;
end;
procedure go2;
var i:integer;
begin
ans[n-1]:=sum[0]-sump;
ans[0]:=sum[1]-sump;
ans[n-2]:=a[n-1]-ans[0]-ans[n-1];
for i:=n-3 downto 1 do
ans[i]:=a[i+1]-ans[i+1]-ans[i+2];
for i:=0 to n-1 do write(ans[i], ' ');
readln;

end;
procedure go0;
begin
ans[0]:=1;
ans[1]:=1;
for i:=2 to n-1 do ans[i]:=a[i-1]-ans[i-1]-ans[i-2];
for i:=0 to n-1 do write(ans[i], ' ');
readln;
end;
begin
{assign(input, 'ff.in');
reset(input);
assign(output, 'ff.out');
rewrite(output);
readln(n);}
sump:=0;
for i:=0 to n-1 do begin
read(a[i]);
b[i div 3, i mod 3]:=a[i];
sump:=sump+a[i];
end;
sump:=sump div 3;
readln;
//close(input);
p:=n div 3;
sum[0]:=0; sum[1]:=0; sum[2]:=0;
for i:=0 to p do begin
sum[0]:=sum[0]+b[i,0];
sum[1]:=sum[1]+b[i,1];
sum[2]:=sum[2]+b[i,2];
end;
case n mod 3 of
0:go0;
1:go1;
2:go2;
end;
//close(output);
end.

0 条评论

目前还没有评论...

信息

ID
1928
难度
8
分类
a 点击显示
标签
(无)
递交数
92
已通过
14
通过率
15%
被复制
2
上传者