Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
请大牛帮忙看看,郁闷死了#include<iostream> using namespace std; int main() { char map[20][20],out[20][20]; memset(map,'.',sizeof(map)); memset(out,'.',sizeof(out)); int i,j,n,lei; cin>>n; for(i=1;i<=n;i++) for(j=1;j<=n;j++) cin>>map[i][j]; char op[20][20]; for(i=1;i<=n;i++) for(j=1;j<=n;j++) cin>>op[i][j]; for(i=1;i<=n;i++) for(j=1;j<=n;j++) { lei=0; if(op[i][j]=='x') { if(map[i][j]=='*') { for(i=1;i<=n;i++) for(j=1;j<=n;j++) if(map[i][j]=='*') out[i][j]='*'; goto out; } for(int k=i-1;k<i+2;k++) for(int s=j-1;s<j+2;s++) if(!(s==j && k==i)) if(map[k][s]=='*') lei++; out[i][j]=lei+48; } } out: for(i=1;i<=n;i++,cout<<endl) for(j=1;j<=n;j++) cout<<out[i][j]; return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator