代码
#include <bits/stdc++.h>
using namespace std;
map<int, int> A;
int n, minn = INT_MAX, maxn = INT_MIN;//头文件中自定义的宏
int main() {
cin >> n;
for (int i = 0; i < n; i++) {
int t;
cin >> t;
A[t]++;//数组统计个数,两个变量统计最大最小值
if (minn > t) minn = t;
if (maxn < t) maxn = t;
}
cout << minn << ' ' << A[minn] << '\n' << maxn << ' ' << A[maxn];
return 0;
}
标签:善良,minn,int,cin,INT,maxn,天梯,L1
From: https://www.cnblogs.com/index-12/p/17339783.html