Affiliate Disclosure: This post contains Amazon affiliate links. If you purchase through these links, eBlogarithm may earn a commission at no extra cost to you. Prices and availability are subject to change.
#include <bits/stdc++.h>
using namespace std;
int main(){
int n, num = 0, x, sum = 0;
scanf(“%d”, &n);
int g=0;
for(int i = 0; i < n; ++i){
scanf(“%d”, &x);
g=__gcd(g,x);
if(x&1){
num ++;
}else{
sum = sum + num/2 + (num%2)*2;
num = 0;
}
}
if(num) sum = sum + num/2 + (num%2)*2;
if (g>1)sum=0;
printf(“YES\n%d\n”, sum);
return 0;
}
📦 Looking for Codeforces Round 410 Div Problem Mike? Check the best deals on Amazon.
🛒 Shop Codeforces Round 410 Div Problem Mike on Amazon
As an Amazon Associate, eBlogarithm earns from qualifying purchases. Prices and availability are subject to change.
Affiliate Disclosure: This post contains Amazon affiliate links. If you purchase through these links, eBlogarithm may earn a commission at no extra cost to you. Prices and availability are subject to change.
#include <bits/stdc++.h>
using namespace std;
int main(){
int n, num = 0, x, sum = 0;
scanf(“%d”, &n);
int g=0;
for(int i = 0; i < n; ++i){
scanf(“%d”, &x);
g=__gcd(g,x);
if(x&1){
num ++;
}else{
sum = sum + num/2 + (num%2)*2;
num = 0;
}
}
if(num) sum = sum + num/2 + (num%2)*2;
if (g>1)sum=0;
printf(“YES\n%d\n”, sum);
return 0;
}
📦 Looking for Codeforces Round 410 Div Problem Mike? Check the best deals on Amazon.
🛒 Shop Codeforces Round 410 Div Problem Mike on Amazon
As an Amazon Associate, eBlogarithm earns from qualifying purchases. Prices and availability are subject to change.