文章

40

粉丝

512

获赞

13

访问

354.0k

头像
这么一题压轴是没有想到
Ang VIP
P1656 北京邮电大学2019年机试题
发布于2020年3月14日 14:58
阅读数 9.4k

#include<bits/stdc++.h>
using namespace std;

char a[101][101];

int main(){
    int pos=0;
    string str;
    int s;
    while(cin>>str){
 //       if(str=="0"){
   //         break;
     //   }
        s=str.size();
        for(int i=0;i<s;i++){
            a[pos][i]=str[i];
        }
        pos++;
    }
    int cx=0;
    for(int i=0;i<pos;i++){
        int temp=0;
        for(int j=0;j<s;j++){
            if(a[i][j]=='#'){
                temp++;
            }
        }
        if(temp>0){
            cx==temp;
            break;
        }
    }
    int cy=0;
    for(int i=0;i<s;i++){
        int temp=0;
        for(int j=0;j<pos;j++){
            if(a[j][i]=='#'){
                temp++;
            }
        }
        if(temp>0){
            cy=temp;
            break;
        }
    }
    int ans;
    if(cx==0&&cy==0){
        ans=-1;
    }else{
        ans=max(cx,cy);
    }
    cout...
登录查看完整内容


登录后发布评论

2 条评论
李瑞晟 VIP
2020年3月23日 19:23

应该不是这个题吧

 

赞(0)

Ang : 回复 李瑞晟: 我觉得也是改了

2020年3月24日 14:17