#include <iostream> using namespace std; int main() { int n,m,sum = 0; cin>>n; char a[n+1][n+1]; for(int i = 1;i<=n;i++){ for(int j = 1;j<=n;j++){ cin>>a[i][j]; } } cin>>m; for(int p = 1;p<m;p++){ for(int i = 1;i<=n;i++){ for(int j = 1;j<=n;j++){ if(a[i][j]=='@'){ for(int y = 0;y<=2;y+=2){ if(a[i-1+y][j]=='*'){ sum++; a[i-1+y][j] = '@'; } if(a[i][j-1+y]=='*'){ sum++; a[i][j-1+y] = '@'; } } } } } } cout<<sum; return 0; }
标签:std,int,sum,cin,计算机病毒,main From: https://www.cnblogs.com/wangyihang-xh/p/17537764.html