

Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 点
問題文
長さ の整数列 が与えられます。また、 を以下で定義します。
- に含まれる値の種類数
次の式の値を求めてください。
制約
- 入力される数値は全て整数
入力
入力は以下の形式で標準入力から与えられる。
出力
答えを出力せよ。
入力例 1Copy
3 1 2 2
出力例 1Copy
8
について考えます。 に含まれる値の種類数は なので です。
について考えます。 に含まれる値の種類数は なので です。
の総和は となります。
入力例 2Copy
9 5 4 2 2 3 2 4 4 1
出力例 2Copy
111
Score : points
Problem Statement
You are given a sequence of integers of length . Define as:
- the number of distinct values in the subsequence .
Evaluate the following expression:
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1Copy
3 1 2 2
Sample Output 1Copy
8
Consider . The subsequence contains distinct values, so .
Consider . The subsequence contains distinct value, so .
The sum of is .
Sample Input 2Copy
9 5 4 2 2 3 2 4 4 1
Sample Output 2Copy
111