IEEExtreme Coding Competition 7.0

We attended International IEEExtreme Coding Competition 7.0 . Today I write the code that we write in competition Problem_Aj. That problem mainly easy but it has some tricky points :) Here is the code : #include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> int main() { int i,num,*p,v=0; //printf("Enter the piece value\n"); scanf("%d",&num); p=(int*)malloc(num*sizeof(int)); //printf("Enter the slope value\n"); for(i=0;i<num;i++) { scanf("%d",&p[i]); printf(" "); } for(i=0;i<num;i++) { v+=p[i]; if(v<0) { ...