Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int t,a,n,i,q;
- scanf("%d",&t);
- while(t--)
- {
- scanf("%d",&n);
- long int l,r,w,sum = 0;
- for(i=0;i<n;i++)
- {
- scanf("%d",&a);
- sum= sum+a;
- }
- scanf("%d",&q);
- while(q--)
- {
- scanf("%ld%ld%ld",&l,&r,&w);
- sum = sum+(r-l+1)*w;
- }
- printf("%ld\n",sum);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement