社区讨论

拿不到80分竟因为他

P2670[NOIP 2015 普及组] 扫雷游戏参与者 5已保存回复 12

讨论操作

快速查看讨论及其快照的属性,并进行相关操作。

当前回复
12 条
当前快照
1 份
快照标识符
@mi6hm0ji
此快照首次捕获于
2025/11/20 05:01
4 个月前
此快照最后确认于
2025/11/20 05:09
4 个月前
查看原帖
CPP
type shit=record
     dl:char;
     sm:integer;
end;
var
s:string;
a:array[-1..1001,-1..1001]of shit;
i,j,n,m:integer;
begin
  readln(n,m);
  for i:=-1 to 1001 do
    for j:=-1 to 1001  do
    a[i,j].sm:=-1;
  for i:=1 to n do
    begin
      readln(s);
      for j:=1 to length(s) do
      a[i,j].dl:=s[j];
    end;
  for i:=1 to n do
    for j:=1 to m do
    a[i,j].sm:=0;
  for i:=1 to n do
    for j:=1 to m do
    begin
      if (a[i,j].dl='*') then
      begin
        if a[i+1,j].sm<>-1 then
          inc(a[i+1,j].sm);
        if a[i+1,j+1].sm<>-1 then
          inc(a[i+1,j+1].sm);
        if a[i+1,j-1].sm<>-1 then
          inc(a[i+1,j-1].sm);
        if a[i,j-1].sm<>-1 then
          inc(a[i,j-1].sm);
        if a[i,j+1].sm<>-1 then
          inc(a[i,j+1].sm);
        if a[i-1,j-1].sm<>-1 then
          inc(a[i-1,j-1].sm);
        if a[i-1,j].sm<>-1 then
          inc(a[i-1,j].sm);
        if a[i-1,j+1].sm<>-1 then
          inc(a[i-1,j+1].sm);
      end;
    end;
  for i:=1 to n do
  begin
    for j:=1 to n do
    begin
    if a[i,j].dl='?' then
      write(a[i,j].sm)
    else write('*');
    end;
    writeln;
  end;
end.

回复

12 条回复,欢迎继续交流。

正在加载回复...