Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
Register

## 哪位神仙帮忙看一下为什么wa了

Posted by yueboyang171 at 2019-03-06 12:39:48 on Problem 3468
```#include <iostream>
#include <cstdio>
#define ll long long
#define MAXN 100010
using namespace std;
ll  q[MAXN], q2[MAXN], sum[MAXN];
ll N, C;
ll lowbit( ll x)
{
return x&(-x);
}

void add(ll *c, ll a, ll x)
{
while( a <= N )
{
c[a] += x;
a += lowbit(a);
}
}

ll query(ll *c , ll a)
{
ll ans = 0;
while( a > 0)
{
ans += c[a];
a-=lowbit(a);
}
return ans;
}
int main()
{
scanf("%lld %lld",&N,&C);
ll temp1 = 0, temp2;
for(int i=1; i<=N; i++)
{
scanf("%lld", &temp2);
temp1 = temp2;
}
char cc;
ll l, r,  x;

for(int i=0; i<C; i++)
{
cin >> cc;
if( cc == 'Q')
{
scanf("%lld %lld", &l, &r);
ll a, b;
a = l * query(q, l-1) - query(q2, l-1);
b = (r+1) * query(q, r) - query( q2, r);
printf("%lld\n",b-a);
}else
{
scanf("%lld %lld %lld", &l, &r, &x);
}
}
return 0;
}```

Followed by: