【阅读理解专练】CF1419C

Killjoy

A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large).

Killjoy's account is already infected and has a rating equal to x. Its rating is constant. There are n accounts except hers, numbered from 1 to n. The i-th account's initial rating is ai. Any infected account (initially the only infected account is Killjoy's) instantly infects any uninfected account if their ratings are equal. This can happen at the beginning (before any rating changes) and after each contest. If an account is infected, it can not be healed.

Contests are regularly held on Codeforces. In each contest, any of these n accounts (including infected ones) can participate. Killjoy can't participate. After each contest ratings are changed this way: each participant's rating is changed by an integer, but the sum of all changes must be equal to zero. New ratings can be any integer.

Find out the minimal number of contests needed to infect all accounts. You can choose which accounts will participate in each contest and how the ratings will change.

It can be proven that all accounts can be infected in some finite number of contests.

Input
The first line contains a single integer t (1≤t≤100) — the number of test cases. The next 2t lines contain the descriptions of all test cases.

The first line of each test case contains two integers n and x (2≤n≤103, −4000≤x≤4000) — the number of accounts on Codeforces and the rating of Killjoy's account.

The second line of each test case contains n integers a1,a2,…,an (−4000≤ai≤4000) — the ratings of other accounts.

Output
For each test case output the minimal number of contests needed to infect all accounts.


Writer 明显说明了“赛前可感染”,“感染后不会变化”...
所以n个用户中若有一开始就和Killjoy相等的rating,就可以在赛前感染,
已经被感染的用户在赛中可以随意变化了
所以特判 :存在x但是平均数不是x的情况需要一次比赛

posted @ 2021-10-07 15:59  qingyanng  阅读(33)  评论(2编辑  收藏  举报