比赛 |
20140713上午练习 |
评测结果 |
AWAWWWWWAA |
题目名称 |
调试LED灯 |
最终得分 |
40 |
用户昵称 |
甘罗 |
运行时间 |
1.587 s |
代码语言 |
Pascal |
内存使用 |
0.17 MiB |
提交时间 |
2014-07-13 10:19:48 |
显示代码纯文本
- program zht;
- var
- l,i,j,n,zs:longint;
- z:array[1..33] of integer;
- a:ansistring;
- begin
- assign(input,'testled.in');
- assign(output,'testled.out');
- reset(input);
- rewrite(output);
- readln(l);
- readln(a);
- for i:=1 to l do
- z[i]:=ord(a[i])-48;
- readln(n);
- readln(a);
- for i:=1 to n do
- begin
- if a[i]='a' then begin for j:=1 to l do z[j]:=1;continue;end;
- if a[i]='b' then begin for j:=1 to l do z[j]:=0;continue;end;
- if a[i]='c' then begin for j:=1 to l do if z[j]=1 then z[j]:=0 else z[j]:=1;continue;end;
- if a[i]='1' then begin for j:=l downto 1 do if j mod 2=1 then if z[l-j+1]=1 then z[l-j+1]:=0 else z[l-j+1]:=1;continue;end;
- if a[i]='2' then begin for j:=l downto 1 do if j mod 2=1 then if z[l-j+1]=1 then z[l-j+1]:=0 else z[l-j+1]:=1;continue;end;
- for j:=1 to ord(a[i])-48 do
- z[j]:=0;
- for j:=l downto l-(ord(a[i])-48)+1 do
- z[j]:=1;
- end;
- for i:=1 to l do
- begin
- write(z[i]);
- if z[i]=1 then zs:=zs+1;
- end;
- writeln;
- writeln(zs);
- close(input);
- close(output)
- end.