The Hurdle Race

Sort by

recency

|

14 Discussions

|

  • + 0 comments

    include

    include

    define max 100

    int main() { int n,k,i,a[max],max1,j; scanf("%d\t%d",&n,&k); for(i=0;imax1) { max1=a[i]; } } j=max1-k; if(j<0) { printf("0"); } else { printf("%d",j); } return 0; }

  • + 1 comment
    import java.io.*;
    import java.util.*;
    import java.text.*;
    import java.math.*;
    import java.util.regex.*;
    
    public class Solution {
    
        public static void main(String[] args) {
            Scanner in = new Scanner(System.in);
            int n = in.nextInt();
            int k = in.nextInt();
            int[] height = new int[n];
            for(int height_i=0; height_i < n; height_i++){
                height[height_i] = in.nextInt();
            }
            int max = 0;
            for(int i=0;i<n;i++){
                if(height[i]>max){max = height[i];}
            }
            
            if(max < k)
                System.out.println(0);
            else
                System.out.println(max-k);
            
        }
    }
    
  • + 0 comments

    simple cpp:

    for (int i = 0; i < n; i++){
            if (mb < height[i]){
                mb = height[i];
            }
        }
        if (mb > k){
            mb = mb - k;
        } else {
            mb = 0;
        }
     
        cout<<mb;
    
  • + 0 comments

    I submitted the code successfully , but it will not shown in my submission board . what can I do ?

  • + 0 comments

    include

    include

    include

    include

    include

    include

    include

    int main(){ int n,i,j=0,c=0; int k,height_i; scanf("%d %d",&n,&k); int *height = malloc(sizeof(int) * n); for(height_i = 0; height_i < n; height_i++){ scanf("%d",&height[height_i]); } for(i=0;ij) j=height[i]; } if(j>k){

    j=j-k;
    printf("%d",j);
    

    } else printf("%d",c);

    // your code goes here
    return 0;
    

    }