0_0_20614563_7122.cpp:10:5: error: 'r' does not name a type
r) continue; if(sum[r]-sum[i-1]<L || sum[r]-sum[i-1]>=R) continue; if(sum[l]-sum[i-1]<L || sum[l]-sum[i-1]>=R) continue; ans+=(long long)(r-l+1)*i+(long long)(l+r)*(r-l+1)/2; } return ans;}int main(){ int T; scanf("%d",&T); while(T--){ scanf("%d",&n); sum[0]=0; for(int i=1;i<=n;i++) { scanf("%d",&a[i]); sum[i]=sum[i-1]+a[i]; } long long ans=0; for(int k=1;k<=34;k++){ ans+=(long long)k*solve(pow(2,k-1),pow(2,k)); } ans+=solve(0,1); printf("%I64d\n",ans); } return 0;}
^
0_0_20614563_7122.cpp:10:25: error: expected unqualified-id before 'if'
r) continue; if(sum[r]-sum[i-1]<L || sum[r]-sum[i-1]>=R) continue; if(sum[l]-sum[i-1]<L || sum[l]-sum[i-1]>=R) continue; ans+=(long long)(r-l+1)*i+(long long)(l+r)*(r-l+1)/2; } return ans;}int main(){ int T; scanf("%d",&T); while(T--){ scanf("%d",&n); sum[0]=0; for(int i=1;i<=n;i++) { scanf("%d",&a[i]); sum[i]=sum[i-1]+a[i]; } long long ans=0; for(int k=1;k<=34;k++){ ans+=(long long)k*solve(pow(2,k-1),pow(2,k)); } ans+=solve(0,1); printf("%I64d\n",ans); } return 0;}
^
0_0_20614563_7122.cpp:10:86: error: expected unqualified-id before 'if'
r) continue; if(sum[r]-sum[i-1]<L || sum[r]-sum[i-1]>=R) continue; if(sum[l]-sum[i-1]<L || sum[l]-sum[i-1]>=R) continue; ans+=(long long)(r-l+1)*i+(long long)(l+r)*(r-l+1)/2; } return ans;}int main(){ int T; scanf("%d",&T); while(T--){ scanf("%d",&n); sum[0]=0; for(int i=1;i<=n;i++) { scanf("%d",&a[i]); sum[i]=sum[i-1]+a[i]; } long long ans=0; for(int k=1;k<=34;k++){ ans+=(long long)k*solve(pow(2,k-1),pow(2,k)); } ans+=solve(0,1); printf("%I64d\n",ans); } return 0;}
^
0_0_20614563_7122.cpp:10:147: error: 'ans' does not name a type
r) continue; if(sum[r]-sum[i-1]<L || sum[r]-sum[i-1]>=R) continue; if(sum[l]-sum[i-1]<L || sum[l]-sum[i-1]>=R) continue; ans+=(long long)(r-l+1)*i+(long long)(l+r)*(r-l+1)/2; } return ans;}int main(){ int T; scanf("%d",&T); while(T--){ scanf("%d",&n); sum[0]=0; for(int i=1;i<=n;i++) { scanf("%d",&a[i]); sum[i]=sum[i-1]+a[i]; } long long ans=0; for(int k=1;k<=34;k++){ ans+=(long long)k*solve(pow(2,k-1),pow(2,k)); } ans+=solve(0,1); printf("%I64d\n",ans); } return 0;}
^
0_0_20614563_7122.cpp:10:205: error: expected declaration before '}' token
r) continue; if(sum[r]-sum[i-1]<L || sum[r]-sum[i-1]>=R) continue; if(sum[l]-sum[i-1]<L || sum[l]-sum[i-1]>=R) continue; ans+=(long long)(r-l+1)*i+(long long)(l+r)*(r-l+1)/2; } return ans;}int main(){ int T; scanf("%d",&T); while(T--){ scanf("%d",&n); sum[0]=0; for(int i=1;i<=n;i++) { scanf("%d",&a[i]); sum[i]=sum[i-1]+a[i]; } long long ans=0; for(int k=1;k<=34;k++){ ans+=(long long)k*solve(pow(2,k-1),pow(2,k)); } ans+=solve(0,1); printf("%I64d\n",ans); } return 0;}
^
|