Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
63666 夏轩淇 二维数组的最大值与最小值 C++ Accepted 1 MS 276 KB 437 2024-01-19 16:44:11

Tests(2/2):


Code:

#include<bits/stdc++.h> using namespace std; int a[10][10]; int main(){ int n; cin>>n; for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ cin>>a[i][j]; } } int max=-2e9,mouse=2e9; for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ if(a[i][j]>max){ max=a[i][j]; } if(a[i][j]<mouse){ mouse=a[i][j]; } } } cout<<mouse<<" "<<max; return 0; }