标签:namespace main com href include std space print 扫雷游戏
地址:https://www.luogu.com.cn/problem/P2670
#include<iostream>int a[105][105]={0}; using namespace std; int main() { int n,m; cin>>n>>m; int i,j; char b; for(i=1; i<=n; i++) { for(j=1; j<=m; j++) { cin>>b; if(b==‘*‘) a[i][j]=1; } } for(i=1; i<=n; i++) { for(j=1; j<=m; j++) { if(a[i][j]==1) { printf("*"); } else { printf("%d",a[i+1][j+1]+a[i+1][j-1]+a[i+1][j]+a[i][j+1]+a[i][j-1]+a[i-1][j+1]+a[i-1][j]+a[i-1][j-1]); } } cout<<endl; } }
标签:namespace main com href include std space print 扫雷游戏
原文地址:https://www.cnblogs.com/jackwang-sparrow/p/13292682.html