19:15 |
int main() { int T; cin>>T; REP(ttt, T) { ll N; cin>>N; VI A(N); REP(i, N) cin>>A[i]; ll lines=0; ll ans=1; REP(i, N) { ans += lines*(A[i]+1) + ((A[i]-1)*A[i]/2) +1; lines += A[i]+1; } cout<<"Case #"<<ttt+1<<": "<<ans<<endl; // break; } return 0; }
ツイートする