题解 | #求最大最小数#
求最大最小数
https://www.nowcoder.com/practice/82e5ff335eeb486aab359767895cc7b4
#include <iostream> #include <set> using namespace std; int main() { int n; while (cin >> n) { // 注意 while 处理多个 case set<int> s; while (n--) { int t; cin>>t; s.insert(t); } cout<<*s.rbegin()<<' '<<*s.begin()<<endl; } return 0; } // 64 位输出请用 printf("%lld")