记录编号 111192 评测结果 AAAAWAAAAA
题目名称 调试LED灯 最终得分 90
用户昵称 GravatarClannad 是否通过 未通过
代码语言 Pascal 运行时间 1.059 s
提交时间 2014-07-13 11:03:23 内存使用 4.44 MiB
显示代码纯文本
var
a:array[1..34]of char;
m,n,b,c,d,i,j,k:longint;
z:array[1..5000000]of char;
begin
assign(input,'testled.in');
assign(output,'testled.out');
reset(input);
rewrite(output);
readln(m);
for i := 1 to m do
read(a[i]);
readln;
readln(n);
for i:=1 to n do
read(z[i]);
for i:=1 to n do
if z[i]='a' then
for j:=1 to m do
a[j]:='1' else
if z[i]='b' then
for j:=1 to m do
a[j]:='0' else
if z[i]='c' then
for j:=1 to m do
if a[j]='0' then a[j]:='1' else a[j]:='0' else
if z[i]='1' then
begin
b:=m;
while b>=1 do
begin
if a[b]='0' then a[b]:='1' else a[b]:='0';
b:=b-2;
end;
end else
if z[i]='2' then
begin
b:=m-1;
while b>=1 do
begin
if a[b]='0' then a[b]:='1' else a[b]:='0';
b:=b-2;
end;
end else
begin
b:=ord(z[i])-ord('0');
for j :=1 to b do
a[j]:='0';
for j:=m downto m-b+1 do
a[j]:='1';
end;
for i:=1 to m do
begin
write(a[i]);
if a[i]='1' then d:=d+1;
end;
writeln;
writeln(d);
close(input);
close(output);
end.