50080. Scan The Blocks

難度:1/5

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>

static inline int max(int a, int b){
return (a > b) ? a : b;
}
static inline int min(int a, int b){
return (a < b) ? a : b;
}

void solve(int n){
int now_num;
int min_num = INT_MAX, max_num = INT_MIN;
for(int i = 0; i < n; i++){
if(scanf("%d", &now_num) == EOF){
printf("%d\n", min_num);
return;
}
else{
min_num = min(min_num, now_num);
max_num = max(max_num, now_num);
}
}
printf("%d\n", max_num);
}

int main(){
int n;
while(scanf("%d", &n) != EOF){
solve(n);
}
}


50080. Scan The Blocks
https://aaronlin1229.github.io/judgegirl_50080/
Author
Akizumi
Posted on
July 17, 2023
Licensed under