Advertisement
swardiantara

Sertifikat.C - OSN 2018

Dec 7th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.48 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <conio.h>
  3.  
  4. #define batasn 100000
  5. #define batasnilai 100
  6.  
  7. int max(int x, int y);
  8.  
  9. int n;
  10. int A[100005];
  11.  
  12. int main(){
  13.  
  14.     int i;
  15.     scanf("%d", &n);
  16.     int maxValue=0;
  17.    
  18.     for (i=1;i<=n;++i){
  19.         scanf("%d", &A[i]);
  20.         maxValue = max(maxValue, A[i]);
  21.     }  
  22.     int ans = 0;
  23.     for (i = 1; i<=n; ++i){
  24.         if (A[i]==maxValue){
  25.             ++ans;
  26.         }
  27.     }
  28.     printf("%d\n",ans);
  29. }
  30.  
  31. int max(int x, int y){
  32.     int j;
  33.     for(j=1;j<=n;j++){
  34.         if(x<y){
  35.             return y;
  36.         }
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement