mirror of
https://github.com/renbaoshuo/202401-programming-assignments.git
synced 2024-11-23 15:48:42 +00:00
32 lines
437 B
C
32 lines
437 B
C
|
#include <stdio.h>
|
||
|
|
||
|
int n, a[1005];
|
||
|
|
||
|
int main() {
|
||
|
scanf("%d", &n);
|
||
|
|
||
|
for (int i = 1; i <= n; i++) {
|
||
|
scanf("%d", &a[i]);
|
||
|
}
|
||
|
|
||
|
int max = a[0];
|
||
|
|
||
|
for (int i = 2; i <= n; i++) {
|
||
|
if (a[i] > max) {
|
||
|
max = a[i];
|
||
|
}
|
||
|
}
|
||
|
|
||
|
int count = 0;
|
||
|
|
||
|
for (int i = 1; i <= n; i++) {
|
||
|
if (a[i] == max) {
|
||
|
count++;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
printf("%d %d\n", max, count);
|
||
|
|
||
|
return 0;
|
||
|
}
|