Advertisement
erfanul007

UVa 11054

Mar 13th, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. typedef unsigned long long int ull;
  5. typedef long long int ll;
  6. typedef vector<int> vi;
  7. typedef vector<ll> vll;
  8. typedef pair<int,int > pii;
  9. typedef vector< pii > vpii;
  10.  
  11. #define sc scanf
  12. //#define pf printf
  13. #define sci(n) scanf("%d",&n)
  14. #define scl(n) scanf("%lld",&n)
  15. #define scd(n) scanf("%lf",&n)
  16. #define scs(s) scanf("%s",s)
  17. #define pfi(n) printf("%d",n)
  18. #define pfl(n) printf("%lld",n)
  19. #define pff(n) cout<<n
  20. #define line printf("\n")
  21. #define spc printf(" ")
  22. #define loop(i,x,y) for(int i=int(x); i<=int(y); i++)
  23. #define rloop(i,y,x) for(int i=int(y); i>=int(x); i--)
  24. #define cspf(i) printf("Pair #%d: ", i)
  25. #define pb push_back
  26. #define mp make_pair
  27. #define ff first
  28. #define ss second
  29. #define all(v) v.begin(),v.end()
  30. #define rall(v) v.rbegin(),v.rend()
  31. #define read() freopen("input.txt", "r", stdin)
  32. #define write() freopen("output.txt", "w", stdout)
  33. /// Constants
  34. #define eps 1e-9
  35. #define inf (1e6)+9
  36. #define PI acos(-1.0) // 3.1415926535897932
  37. #define MAX 1000009
  38.  
  39.  
  40. int main()
  41. {
  42. int n;
  43. while(cin>>n && n){
  44. ll temp=0,sum=0,x;
  45. while(n--){
  46. cin>>x;
  47. temp+=x;
  48. sum+=abs(temp);
  49. }
  50. cout<<sum<<endl;
  51. }
  52. return 0;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement