From 604313a57b436d2952077e66b00b63d20211ccdb Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Mon, 9 May 2022 08:15:13 +0800 Subject: [PATCH] A - Tokitsukaze and All Zero Sequence https://codeforces.com/contest/1678/submission/156370569 --- Codeforces/1678/A/A.cpp | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Codeforces/1678/A/A.cpp diff --git a/Codeforces/1678/A/A.cpp b/Codeforces/1678/A/A.cpp new file mode 100644 index 00000000..6dd9f518 --- /dev/null +++ b/Codeforces/1678/A/A.cpp @@ -0,0 +1,37 @@ +#include +#include + +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; +}