题解 | #求最大最小数#
求最大最小数
https://www.nowcoder.com/practice/82e5ff335eeb486aab359767895cc7b4
#include <stdio.h> int main(){ int N; while (scanf("%d", &N) != EOF){ long long num[N]; scanf("%lld", &num[0]); long long max = num[0]; long long min = num[0]; for (int i = 1; i < N; ++i) { scanf("%lld", &num[i]); if (num[i] > max){ max = num[i]; } if (num[i] < min){ min = num[i]; } } printf("%lld %lld\n", max, min); } return 0; }