mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-12-24 17:51:58 +00:00
A - Tokitsukaze and All Zero Sequence
https://codeforces.com/contest/1678/submission/156370569
This commit is contained in:
parent
654ec109e5
commit
604313a57b
37
Codeforces/1678/A/A.cpp
Normal file
37
Codeforces/1678/A/A.cpp
Normal file
@ -0,0 +1,37 @@
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
|
||||
using std::cin;
|
||||
using std::cout;
|
||||
const char endl = '\n';
|
||||
|
||||
int t, n, a[1010];
|
||||
|
||||
signed main() {
|
||||
std::ios::sync_with_stdio(false);
|
||||
|
||||
cin >> t;
|
||||
|
||||
while (t--) {
|
||||
int cnt = 0;
|
||||
|
||||
cin >> n;
|
||||
for (int i = 0; i < n; i++) {
|
||||
cin >> a[i];
|
||||
}
|
||||
|
||||
std::sort(a, a + n);
|
||||
|
||||
for (int i = 0; i < n; i++) {
|
||||
cnt += !a[i];
|
||||
}
|
||||
|
||||
bool f = false;
|
||||
for (int i = 1; i < n; i++)
|
||||
f = f || (a[i] == a[i - 1]);
|
||||
|
||||
cout << (cnt ? n - cnt : n + !f) << endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user