why am i getting run time error.........?
problem=https://www.spoj.pl/problems/DCEPC206/
my code:
#include<stdio.h>
int main()
{
short t;
long n,i,c,prev;
long a;
scanf("%d",&t);
while(t--)
{
c=0;
scanf("%ld",&n);
scanf("%ld",&prev);
c=prev;
for(i=1;i<n;i++)
{
scanf("%ld",&a);
if(a==prev);
else if(a>prev)
c=c+(a-prev);
else
c+=a;
prev=a;
}
printf("%ld\n",c);
}
//scanf("%d");
return 0;
}
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.