题解 | #求最大最小数#好简单,最顺利的一道
求最大最小数
https://www.nowcoder.com/practice/82e5ff335eeb486aab359767895cc7b4?tpId=40&tqId=21344&rp=1&ru=/ta/kaoyan&qru=/ta/kaoyan&difficulty=&judgeStatus=&tags=/question-ranking
#include<iostream> using namespace std; int N=10000; int main(){ int n; int max=0,min=0; for(int i=0;i<N;i++){ int x; cin>>x; if(x>max) max=x; if(x<min) min=x; if(i==n) break; } cout<<max<<" "<<min<<endl; }