-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbjoon_10818.cpp
More file actions
50 lines (39 loc) · 901 Bytes
/
Copy pathbjoon_10818.cpp
File metadata and controls
50 lines (39 loc) · 901 Bytes
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#define _CRT_SECURE_NO_WARNNGS
#include <stdio.h>
int main(void){
int n;
scanf("%d",&n);
int arr[1000000];
for(int i = 0; i < n; i++){
scanf("%d", &arr[i]);
}
int min= 1000000;
int max = -1000000;
for(int i = 0; i <= n-1; i++){
if(arr[i] < min) {
min = arr[i];
}
/* else{
int temp = arr[i+1];
if(temp <= min) min = temp;
}*/
}
for(int i = 0; i <= n-1; i++){
if( max < arr[i]) {
max = arr[i];
}
/*
for(int i = 0; i <= n-2; i++){
if(arr[i] < arr[i+1]) {
int temp = arr[i+1];
if(temp > max) max = temp;
}
*/
/* else{
int temp = arr[i];
if(temp >= max) max = temp;
}*/
}
printf("%d %d", min, max);
return 0;
}