杭电acm2107
#include <stdio.h> int main() { long n, i, max, temp; while(~scanf("%d", &n) && n) { i = n - 1; while(n--) { scanf("%ld", &temp); if(n == i) { max = temp; } else if(max < temp) max = temp; } printf("%ld\n", max); } return 0; }
#include <stdio.h> int main() { long n, i, max, temp; while(~scanf("%d", &n) && n) { i = n - 1; while(n--) { scanf("%ld", &temp); if(n == i) { max = temp; } else if(max < temp) max = temp; } printf("%ld\n", max); } return 0; }