Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
93760 杨珞烯 二维数组的最大值与最小值 C++ Accepted 1 MS 272 KB 339 2024-10-19 11:03:28

Tests(2/2):


Code:

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