[Init] Solved solutions

This commit is contained in:
tiennm99 committed 2023-03-02 20:58:03 +07:00
1 parent 51f667ac81
commit 20542601dd
131 files changed
+4148

No files matched your search

+35
View File
@@ -0,0 +1,35 @@
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
int n;
cin >> n;
int i1, i2, c1 = 0, c2 = 0;
while (n--)
{
int t;
cin >> t;
if (t%2)
{
c1++;
i1 = c1 + c2;
}
else
{
c2++;
i2 = c1 + c2;
}
}
if (c1 < c2)
{
cout << i1;
}
else
{
cout << i2;
}
return 0;
}