#include<cstdio> int main() { int N, Max, Min, x; while (scanf("%d", &N) != EOF) { Max = -10000000, Min = 10000000; while (N--) { scanf("%d", &x); if (Max<x) Max = x;//写法很好,看看人家的 if (Min>x) Min = x; } printf("%d %d\n", Max, Min); } }
时间: 2024-10-23 05:15:23