

Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 点
問題文
ボールが 個あり、 番目のボールには整数 が書かれています。
に対して以下の問題を解いて、答えをそれぞれ出力してください。
- 番目のボールを除いた 個のボールから、書かれている整数が等しいような異なる つのボールを選び出す方法の数を求めてください。選ぶ順序は考慮しません。
制約
- 入力はすべて整数である。
入力
入力は以下の形式で標準入力から与えられる。
出力
に対する答えを順番に一行ずつ出力せよ。
入力例 1Copy
5 1 1 2 1 2
出力例 1Copy
2 2 3 2 3
例えば のとき、残りのボールに書かれている数はそれぞれ です。
この中から書かれている数が等しいような異なる つのボールを選び出す方法は 通りあります。
したがって、 に対する問題の答えは です。
入力例 2Copy
4 1 2 3 4
出力例 2Copy
0 0 0 0
どの つのボールを選び出しても、書かれている数は等しくありません。
入力例 3Copy
5 3 3 3 3 3
出力例 3Copy
6 6 6 6 6
どの つのボールを選び出しても、書かれている数が等しいです。
入力例 4Copy
8 1 2 1 4 2 1 4 1
出力例 4Copy
5 7 5 7 7 5 7 5
Score : points
Problem Statement
We have balls. The -th ball has an integer written on it.
For each , solve the following problem and print the answer.
- Find the number of ways to choose two distinct balls (disregarding order) from the balls other than the -th ball so that the integers written on them are equal.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
For each , print a line containing the answer.
Sample Input 1Copy
5 1 1 2 1 2
Sample Output 1Copy
2 2 3 2 3
Consider the case for example. The numbers written on the remaining balls are .
From these balls, there are two ways to choose two distinct balls so that the integers written on them are equal.
Thus, the answer for is .
Sample Input 2Copy
4 1 2 3 4
Sample Output 2Copy
0 0 0 0
No two balls have equal numbers written on them.
Sample Input 3Copy
5 3 3 3 3 3
Sample Output 3Copy
6 6 6 6 6
Any two balls have equal numbers written on them.
Sample Input 4Copy
8 1 2 1 4 2 1 4 1
Sample Output 4Copy
5 7 5 7 7 5 7 5