798 C. Mike and gcd problem
来源:互联网 发布:手机淘宝如何找同款 编辑:程序博客网 时间:2024/06/05 02:45
#include<iostream>#include<vector>#include<string>#include<set>#include<map>#include<algorithm>#include<queue>using namespace std;int gcd(int a, int b){while (a > 0){int c = b%a;b = a;a = c;}return b;}int main(){int n;while (cin >> n){vector<int> demo(n);int temp_c = 0;int amount = 0;int g = 0;for (int i = 0; i < n; i++){cin >> demo[i];g = gcd(g, demo[i]);if (demo[i] % 2) temp_c++;else {amount += (temp_c / 2) + 2 * (temp_c % 2);temp_c = 0;}}amount += (temp_c / 2) + 2 * (temp_c % 2);cout << "YES" << endl;if (g == 1) cout << amount << endl;else cout << "0" << endl;}return 0;}
0 0
- cf 798c Mike and gcd problem
- Codeforces 798C Mike and gcd problem
- 798 C. Mike and gcd problem
- codeforces 798C Mike and gcd problem
- CodeForces 798C Mike and gcd problem
- Codeforces 798C Mike and GCD problem
- C. Mike and gcd problem
- C. Mike and gcd problem
- Codeforces 798C Mike and gcd problem gcd+贪心
- codeforce 798C Mike and gcd problem (简单数学)
- Codeforces-798C-Mike and gcd problem(贪心+数论)
- CF#798 C. Mike and gcd problem(思维)
- Codeforces 798C Mike and gcd problem (贪心)
- CF --- 798 C Mike and gcd problem 【思维】
- Codeforces 798C:Mike and gcd problem【数论+贪心】
- Codefroces 410 C. Mike and gcd problem
- 789C Mike and gcd problem
- Mike and gcd problem
- 短信发送一次显示两条之谜
- JavaWeb中文件上传
- python3.6 安装tensorflow
- 自动化测试 (二) 连连看外挂
- 给UILabel添加边框
- 798 C. Mike and gcd problem
- Android 在某一页禁止home键返回
- RcppQuantuccia 0.0.1
- 开启rul rewrite 出现 No input file specified 的解决方法
- 超强OCR文字识别软件首选ABBYY FineReader
- Linux入门1(手记)
- 点击EditText以外的地方隐藏输入框和软键盘
- 推荐!手把手教你使用Git
- Android Studio 快捷键整理