#include <iostream>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
using namespace std;
#define LL long long
#define MAXN 100100
int main()
{
int n;
while(scanf("%d",&n) != EOF && n)
{
LL last = 0;
LL ans = 0;
LL a;
while( n-- )
{
scanf("%lld",&a);
last += a;
ans += abs(last);
}
printf("%lld\n",ans);
}
}
UVA 11054
最新推荐文章于 2021-08-15 10:52:00 发布