#include<iostream>
#include<cstdio> using namespace std; char a[101][101]; int b[101][101]; int main(){ freopen("2015mine.in","r",stdin); freopen("2015mine.out","w",stdout); int m,n; cin>>m>>n; for(int i=1;i<=m;i++){ for(int j=1;j<=n;j++){ cin>>a[i][j]; } } for(int i=1;i<=m;i++){ for(int j=1;j<=n;j++){ if(a[i][j]=='*'){ if(a[i+1][j]=='?')b[i+1][j]++; if(a[i][j+1]=='?')b[i][j+1]++; if(a[i-1][j]=='?')b[i-1][j]++; if(a[i][j-1]=='?')b[i][j-1]++; if(a[i+1][j+1]=='?')b[i+1][j+1]++; if(a[i+1][j-1]=='?')b[i+1][j-1]++; if(a[i-1][j-1]=='?')b[i-1][j-1]++; if(a[i-1][j+1]=='?')b[i-1][j+1]++; } } } for(int i=1;i<=m;i++){ for(int j=1;j<=n;j++){ if(a[i][j]=='*'){ cout<<"*"; }else{ cout<<b[i][j]; } } cout<<endl; } return 0; }回复 @羊凢 :
题目 2111 [NOIP 2015PJ]扫雷游戏
2018-11-26 18:34:47
|
|
#include<iostream>
#include<cstdio> using namespace std; char a[101][101]; int b[101][101]; int main(){ freopen("2015mine.in","r",stdin); freopen("2015mine.out","w",stdout); int m,n; cin>>m>>n; for(int i=1;i<=m;i++){ for(int j=1;j<=n;j++){ cin>>a[i][j]; } } for(int i=1;i<=m;i++){ for(int j=1;j<=n;j++){ if(a[i][j]=='*'){ if(a[i+1][j]=='?')b[i+1][j]++; if(a[i][j+1]=='?')b[i][j+1]++; if(a[i-1][j]=='?')b[i-1][j]++; if(a[i][j-1]=='?')b[i][j-1]++; if(a[i+1][j+1]=='?')b[i+1][j+1]++; if(a[i+1][j-1]=='?')b[i+1][j-1]++; if(a[i-1][j-1]=='?')b[i-1][j-1]++; if(a[i-1][j+1]=='?')b[i-1][j+1]++; } } } for(int i=1;i<=m;i++){ for(int j=1;j<=n;j++){ if(a[i][j]=='*'){ cout<<"*"; }else{ cout<<b[i][j]; } } cout<<endl; } return 0; } 暴力
题目 2111 [NOIP 2015PJ]扫雷游戏
2018-10-23 17:30:46
|
|
题目 2111 [NOIP 2015PJ]扫雷游戏
2018-09-14 12:52:32
|
|
秀
天秀 陈独秀
题目 2111 [NOIP 2015PJ]扫雷游戏
2018-09-14 12:51:13
|
|
终于过了
我对不起江东父老
题目 2111 [NOIP 2015PJ]扫雷游戏
2018-09-09 15:13:40
|
|
暴搜。。。
|
|
题目 2111 [NOIP 2015PJ]扫雷游戏
2015-12-13 17:17:52
|
|
|
|
复赛留念
题目 2111 [NOIP 2015PJ]扫雷游戏
2015-11-22 21:36:06
|
|
我很想知道今年普及组的分数会比去年高多少
题目 2111 [NOIP 2015PJ]扫雷游戏
2015-11-15 15:26:59
|
|
暴搜也能过
|