Logo
(追記) (追記ここまで)

21818번 - Do You Know Your ABCs? 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 512 MB29113110243.966%

문제

Farmer John's cows have been holding a daily online gathering on the "mooZ" video meeting platform. For fun, they have invented a simple number game to play during the meeting to keep themselves entertained.

Elsie has three positive integers $A,ドル $B,ドル and $C$ (1ドル\le A\le B\le C$). These integers are supposed to be secret, so she will not directly reveal them to her sister Bessie. Instead, she tells Bessie $N$ (4ドル\le N\le 7$) distinct integers $x_1,x_2,\ldots,x_N$ (1ドル\le x_i\le 10^9$), claiming that each $x_i$ is one of $A,ドル $B,ドル $C,ドル $A+B,ドル $B+C,ドル $C+A,ドル or $A+B+C$. However, Elsie may be lying; the integers $x_i$ might not correspond to any valid triple $(A,B,C)$.

This is too hard for Bessie to wrap her head around, so it is up to you to determine the number of triples $(A,B,C)$ that are consistent with the numbers Elsie presented (possibly zero).

Each input file will contain $T$ (1ドル\le T\le 100$) test cases that should be solved independently.

입력

The first input line contains $T$.

Each test case starts with $N,ドル the number of integers Elsie gives to Bessie.

The second line of each test case contains $N$ distinct integers $x_1,x_2,\ldots,x_N$.

출력

For each test case, output the number of triples $(A,B,C)$ that are consistent with the numbers Elsie presented.

제한

예제 입력 1

10
7
1 2 3 4 5 6 7
4
4 5 7 8
4
4 5 7 9
4
4 5 7 10
4
4 5 7 11
4
4 5 7 12
4
4 5 7 13
4
4 5 7 14
4
4 5 7 15
4
4 5 7 16

예제 출력 1

1
3
5
1
4
3
0
0
0
1

힌트

For $x=\{4,5,7,9\},ドル the five possible triples are as follows: $$(2, 2, 5), (2, 3, 4), (2, 4, 5), (3, 4, 5), (4, 5, 7).$$

출처

Olympiad > USA Computing Olympiad > 2020-2021 Season > USACO 2021 US Open Contest > Silver 2번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /