4 条题解

  • 0
    @ 2024-11-1 18:08:20

    6

    #include <bits/stdc++.h>
    using namespace std;
    int a,b,t[105][105];
    int sum;
    int minn,maxx;
    int main(){
    	cin >> a >> b;
    	for(int i = 1 ; i <= a ; i++){
    		for(int j = 1 ; j <= b ; j++){
    			cin >> t[i][j];
    		}
    	}
    	for(int i = 1 ; i <= a ; i++){
    		minn =INT_MAX;
    		maxx=INT_MIN;
    		for(int j = 1 ; j <= b ; j++){
    			minn = min(minn,t[i][j]);
    		}
    		for(int j = 1 ; j <= b ; j++){
    			if(t[i][j] == minn){
    				for(int k = 1 ; k <= a ; k++){
    					maxx = max(maxx,t[k][j]);
    				}
    				if(t[i][j] == maxx){
    					sum++;
    					cout << i << " " << j << " " << t[i][j] << endl; 
    				}
    			}
    		}
    	}
    	if(!sum){
    		cout << "no find"<<endl;
    	}
    	return 0;
    }
    
    • 0
      @ 2024-10-25 18:30:25
      #include <bits/stdc++.h>
      using namespace std;
      int a,b,c[114][114],minn,maxn,sum = 0;
      int main(){
      	cin >> a >> b;
      	for(int i = 1 ; i <= a ; i++) for(int j = 1 ; j <= b ; j++) cin >> c[i][j];
      	for(int i = 1 ; i <= a ; i++){
      		minn = 1145141919,maxn = -1145141919;
      		for(int j = 1 ; j <= b ; j++) minn = min(minn,c[i][j]);
      		for(int j = 1 ; j <= b ; j++){
      			if(c[i][j] == minn){
      				for(int k = 1 ; k <= a ; k++) maxn = max(maxn,c[k][j]);
      				if(c[i][j] == maxn){
      					sum++;
      					cout << i << " " << j << " " << c[i][j] << endl; 
      				}
      			}
      		}
      	}
      	if(sum == 0) cout << "no find\n";
      	return 0;
      }
      
      • 0
        #include <math.h>
        #include <stdio.h>
        #include <iostream>
        #include <string.h>
        #include <algorithm>
        using namespace std;
        const int N=1e4+10;
        int a[N][N],maxx[N],minn[N],n,m;
        bool f;
        int main()
        {
            cin>>n>>m;
        	memset(minn,0x3f3f3f,N);
        	for(int i=1;i<=n;i++)
        	{
        		for(int j=1;j<=m;j++)
        		{
        			cin>>a[i][j];
        			minn[i]=min(minn[i],a[i][j]);
        		}
        	}
        	for(int j=1;j<=m;j++)
        	{
        		for(int i=1;i<=n;i++)
        		{
        			maxx[j]=max(maxx[j],a[i][j]);
        		}
        	}
        	for(int i=1;i<=n;i++)
        	{
        		for(int j=1;j<=m;j++)
        		{
        			if(minn[i]==a[i][j] && maxx[j]==a[i][j])
        			{
        				cout<<i<<" "<<j<<' '<<a[i][j]<<endl;
        				f=1;
        			}
        		}
        	}
        	if(!f)
        	{
        		cout<<"no find";
        	}
            return 0;
        }
        
        
        • 0
          @ 2023-4-22 12:40:30

          暴力枚举 AC

          #include<bits/stdc++.h>
          using namespace std;
          const int N = 105;
          int n,m,a[N][N],maxi[N],mini[N];
           
          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++){	//每行最小值
          		mini[i] = a[i][1];
          		for (int j=2; j<=m; j++)
          			if (mini[i]>a[i][j]) mini[i]=a[i][j];
          	}
          	for (int j=1; j<=m; j++){	//每列最大值
          		maxi[j] = a[1][j];
          		for (int i=2; i<=n; i++)
          			if (maxi[j]<a[i][j]) maxi[j]=a[i][j];
          	}
          	int cnt=0;	//计数
          	for (int i=1; i<=n; i++)
          		for (int j=1; j<=m; j++)
          			if (a[i][j]==mini[i] && a[i][j]==maxi[j]){
          				cout<<i<<" "<<j<<" "<<a[i][j]<<endl;
          				cnt++;
          			}
          	if (!cnt) cout<<"no find\n";
          	return 0;
          }
          
          • 1

          信息

          ID
          1062
          时间
          1000ms
          内存
          128MiB
          难度
          6
          标签
          递交数
          165
          已通过
          55
          上传者