From fa59139eb07c5bb6737d2b3840f1542b765ce253 Mon Sep 17 00:00:00 2001 From: Hugo Bezerra Date: Tue, 20 Oct 2020 14:53:49 -0300 Subject: [PATCH] Add codeforces 1433b --- codeforces/B/1433b.cpp | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 codeforces/B/1433b.cpp diff --git a/codeforces/B/1433b.cpp b/codeforces/B/1433b.cpp new file mode 100644 index 0000000..d95f61c --- /dev/null +++ b/codeforces/B/1433b.cpp @@ -0,0 +1,37 @@ +#include + +using namespace std; + +int main () { + + int n, size, book; + int first, total, zero; + + cin >> n; + + while(n--) + { + cin >> size; + + first = total = zero = 0; + + while(size--) + { + cin >> book; + + if(first == 0 && book == 1) + first = 1; + else if(first == 1 && book == 0) + zero++; + else if(first == 1 && book == 1) + { + total += zero; + zero = 0; + } + } + + cout << total << endl; + } + + return 0; +}