407095: GYM102697 066 Neural Network Weight Count

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

066. Neural Network Weight Counttime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

As computers have become more and more powerful, the use of artificial intelligence has become ever more prominent in modern computing. As a result, a mechanism called a neural network has become a very commonly used tool for replicating the basic biological processes that result in the function of the brain. Neural Networks are composed of a series of "layers" of nodes, where each node of layer $$$i$$$ will connect with every node of layer $$$i+1$$$.

The structure of the network is not very important for the problem, and you do not need to know any more specifics about neural networks or their usage. Instead, you will need to calculate the total number of weights(connections between two nodes) in a given network. Weights can be seen in the image as the crossing lines between nodes. The input will provide the number of layers(including the input and output layers), as well as the number of nodes in each layer respectively.Input

The first line contains a single integer $$$N$$$ that represents the number of layers. The next line contains $$$N$$$ space-separated integers that represent the number of nodes in each layer respectively.

Output

A single integer that represents the total number of weights in the network.

ExampleInput
3
5 10 5
Output
100

加入题单

算法标签: