104B - Testing Pants for Sadness - CodeForces Solution


math *1100

Please click on ads to support us..

C++ Code:

#include <iostream>
#include<algorithm>
#define int long long
using namespace std;
int n,ans,a[105];
signed main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL),cout.tie(NULL);
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	for(int i=1;i<=n;i++)
		ans+=a[i]+(a[i]-1)*(i-1);
	cout<<ans<<'\n';
	return 0;}


Comments

Submit
0 Comments
More Questions

Going to office
Color the boxes
Missing numbers
Maximum sum
13 Reasons Why
Friend's Relationship
Health of a person
Divisibility
A. Movement
Numbers in a matrix
Sequences
Split houses
Divisible
Three primes
Coprimes
Cost of balloons
One String No Trouble
Help Jarvis!
Lift queries
Goki and his breakup
Ali and Helping innocent people
Book of Potion making
Duration
Birthday Party
e-maze-in
Bricks Game
Char Sum
Two Strings
Anagrams
Prime Number