hiho week 39 register

Ended

Participants:2159

Verdict:Time Limit Exceeded
Score:50 / 100
Submitted:2015-04-02 23:05:50

Lang:GCC

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <stdio.h>
    
int main(void) {
    int a, b,num,*array,i,j,k,count=0;
    scanf("%d", &num);
    array=(int*)malloc(num*sizeof(int*));
    for( i=0;i<num;i++){
        scanf("%d",&a);
        array[i]=a;
    }
    for(j=0;j<num-1;j++){
        for(k=j+1;k<num;k++){
            if(array[j]>array[k]) count++;
        }
    }
    printf("%d\n", count);
    
    return 0;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX