记录编号 116608 评测结果 AAAAAAAAAA
题目名称 调试LED灯 最终得分 100
用户昵称 Gravatarhelloworld123 是否通过 通过
代码语言 Pascal 运行时间 1.428 s
提交时间 2014-08-26 12:00:14 内存使用 0.17 MiB
显示代码纯文本
program cogs1674;
const
 maxn=100;
var
 s:char;
 total,m,n,i,j:longint;
 a:array[1..maxn] of char;
procedure zuo(s:char);
var
 i,j,code,x:longint;
begin
 if (ord(s)<51) or (ord(s)>96) then
 begin
 case s of
  'a':for i:=1 to n do a[i]:='1';
  'b':for i:=1 to n do a[i]:='0';
  'c':for i:=1 to n do if a[i]='1' then a[i]:='0' else a[i]:='1';
  '1':for i:=n downto 1 do
    if (n-i+1) mod 2=1 then
	  if a[i]='1' then a[i]:='0' else a[i]:='1';
  '2':for i:=n downto 1 do
    if (n-i+1) mod 2=0 then
	  if a[i]='0' then a[i]:='1' else a[i]:='0';
  end;
 end else
 begin
  val(s,x,code);
  for i:=1 to  x do
  begin
   a[n-i+1]:='1';
   a[i]:='0';
  end;
 end;

end;
begin
 assign(input,'testled.in'); reset(input);
 assign(output,'testled.out'); rewrite(output);
  readln(n);
  for i:=1 to n do
   read(a[i]);
  readln(m);
  for i:=1 to m do
   begin
    read(s);
	zuo(s);
   end;
    total:=0;
   for i:= 1 to n do
   begin
    write(a[i]);
	if a[i]='1' then inc(total);
   end;
   writeln;
   writeln(total);
 close(input); close(output);
end.