问题标题: 14514

0
0

0
0
0
周毅
周毅
资深光能
资深光能

#include<iostream>

#include<algorithm>

using namespace std;

int n,m;

char a[55][55];

int main(){

    cin>>n>>m;

    for(int i=1;i<=n;i++){

        for(int j=1;j<=m;j++){

            cin>>a[i][j];

        }

    }

    for(int i=1;i<=n;i++){

        for(int j=1;j<=m;j++){

            if(a[i][j]=='*'){

                if(i!=1&&i!=n&&j!=1&&j!=m){

                    if(a[i][j+1]=='+'&&a[i][j-1]=='+'&&a[i+1][j]=='+'&&a[i-1][j]=='+'){

                        a[i][j]='0';

                    }

                }else{

                    if(i==1&&j==1){

                        if(a[i][j+1]=='+'&&a[i+1][j]=='+'){

                            a[i][j]='0';

                        }

                    }

                    else if(i==1&&j==n){

                        if(a[i][j-1]=='+'&&a[i+1][j]=='+'){

                            a[i][j]='0';

                        }

                    }

                    else if(i==n&&j==1){

                        if(a[i][j+1]=='+'&&a[i-1][j]=='+'){

                            a[i][j]='0';

                        }

                    }

                    else if(i==n&&j==m){

                        if(a[i][j-1]=='+'&&a[i-1][j]=='+'){

                            a[i][j]='0';

                        }

                    }

                    else{

                        if(i==1){

                            if(a[i][j+1]=='+'&&a[i][j-1]=='+'&&a[i+1][j]=='+'){

                                a[i][j]='0';

                            }

                        }else if(i==n){

                            if(a[i][j+1]=='+'&&a[i][j-1]=='+'&&a[i-1][j]=='+'){

                                a[i][j]='0';

                            }

                        }else if(j==1){

                            if(a[i][j+1]=='+'&&a[i+1][j]=='+'&&a[i-1][j]=='+'){

                                a[i][j]='0';

                            }

                        }else{

                            if(a[i][j-1]=='+'&&a[i+1][j]=='+'&&a[i-1][j]=='+'){

                                a[i][j]='0';

                            }

                        }

                    }

                }

            }

        }

    }

    for(int i=1;i<=n;i++){

        for(int j=1;j<=m;j++){

            cout<<a[i][j]<<' ';

        }

        cout<<endl;

    }

return 0;

}

 

0
0
周毅
周毅
资深光能
资深光能

#include<iostream>
#include<cmath>
using namespace std;
int a,n;
int main(){
    string s;
    cin>>s;
    n=s.length()-1;
    s[n]+=1;
    while(1){
        bool f;
        f=1;
        for(int i=0;i<s.length();i++){
            if(s[i]==':'){
                s[i]='0';
                s[i-1]++;
                f=0;
            }
        }
        if(f==1){
            break;
        }
    }
    if(s[0]=='0'){
        cout<<1<<s;
    }
    else{
        cout<<s;
    }
    return 0;

0
0
马伟翔
马伟翔
初级光能
初级光能

干啥呢?

这么久了,你们不会还在一个班吧。。。

传课后作业答案是吧,你们上到哪了

0
0
0
吕忆航
吕忆航
高级光能
高级光能

???

你在干嘛~~哎呦

0
0
我要回答