AtCoder Regular Contest 080 C - 4-adjacent
地址:http://arc080.contest.atcoder.jp/tasks/arc080_a
题目:
C - 4-adjacent
Time limit : 2sec / Memory limit : 256MB
Score : 400 points
Problem Statement
We have a sequence of length N, a=(a1,a2,…,aN). Each ai is a positive integer.
Snuke's objective is to permute the element in a so that the following condition is satisfied:
- For each 1≤i≤N−1, the product of ai and ai+1 is a multiple of 4.
Determine whether Snuke can achieve his objective.
Constraints
- 2≤N≤105
- ai is an integer.
- 1≤ai≤109
Input
Input is given from Standard Input in the following format:
N
a1 a2 … aN
Output
If Snuke can achieve his objective, print Yes; otherwise, print No.
思路:求膜2为1,膜4为0的数有多少个就好了。
#include <bits/stdc++.h> using namespace std; #define MP make_pair
#define PB push_back
typedef long long LL;
typedef pair<int,int> PII;
const double eps=1e-;
const double pi=acos(-1.0);
const int K=1e6+;
const int mod=1e9+; int n,a,b,c,ans; int main(void)
{
scanf("%d",&n);
for(int i=,x;i<=n;i++)
{
scanf("%d",&x);
if(x%==) c++;
else if(x%==) b++;
else a++;
}
c-=a;
if(c>=||(c==-&&b==)) puts("Yes");
else puts("No");
return ;
}
AtCoder Regular Contest 080 C - 4-adjacent的更多相关文章
- AtCoder Regular Contest 080 E - Young Maids
地址:http://arc080.contest.atcoder.jp/tasks/arc080_c 题目: E - Young Maids Time limit : 2sec / Memory li ...
- AtCoder Regular Contest 080 D - Grid Coloring
地址:http://arc080.contest.atcoder.jp/tasks/arc080_b 题目: D - Grid Coloring Time limit : 2sec / Memory ...
- AtCoder Regular Contest 080 E:Young Maids
题目传送门:https://arc080.contest.atcoder.jp/tasks/arc080_c 题目翻译 给你一个\(n\)的排列\(p\),一个空序列\(q\),你每次可以从\(p\) ...
- AtCoder Regular Contest 080 [CDEF]
C - 4-adjacent Time limit : 2sec / Memory limit : 256MB Problem Statement We have a sequence of leng ...
- AtCoder Regular Contest 080
手贱去开了abc,这么无聊.直接arc啊 C - 4-adjacent Time limit : 2sec / Memory limit : 256MB Score : 400 points Prob ...
- AtCoder Regular Contest 080 (ARC080) E - Young Maids 线段树 堆
原文链接http://www.cnblogs.com/zhouzhendong/p/8934377.html 题目传送门 - ARC080 E - Young Maids 题意 给定一个长度为$n$的 ...
- 【递归】【线段树】【堆】AtCoder Regular Contest 080 E - Young Maids
给你一个1~n的排列p,n是偶数,每次从中任选一对相邻的数出来,插到排列q的开头,如此循环,问你所能得到的字典序最小的排列q. 我们先确定q开头的两个数q1,q2,q1一定是p的奇数位的最小的数,而q ...
- AtCoder Regular Contest 061
AtCoder Regular Contest 061 C.Many Formulas 题意 给长度不超过\(10\)且由\(0\)到\(9\)数字组成的串S. 可以在两数字间放\(+\)号. 求所有 ...
- AtCoder Regular Contest 094 (ARC094) CDE题解
原文链接http://www.cnblogs.com/zhouzhendong/p/8735114.html $AtCoder\ Regular\ Contest\ 094(ARC094)\ CDE$ ...
随机推荐
- react-native新导航组件react-navigation详解
http://blog.csdn.net/sinat_17775997/article/details/70176688
- 编程之美 set 21 24点游戏
题目 输入: n1, n2, n3, n4 (1~13) 输出: 若能得到运算结果为 24, 则输出一个对应的运算表达式 如: 输入: 11, 8, 3, 5 输出: (11-8) * (3*5) = ...
- 进击的RecyclerView入门二(来点小装饰?)
接着上一讲,我们看到我们的Demo可以正常的运行,并且能自动加载网络图片,那么为了后面观察的方便,我们取消这种自动加载的功能,使用两个按钮来代替,分别用来增加一个数据和减少一个数据.截图如下: 正在我 ...
- 使用Git分支开发新特性或修复Bug与使用Git分支开发新特性或修复Bug
使用Git分支开发新特性或修复Bug 通过分支,可以在不影响原有代码的前提下改变代码,主要用于开发新功能新特性.下 一代产品 为已经发布的正式版修复bug 团队开发时为每个人建立一个分支,从而避免相互 ...
- Java中分页功能源码实例
一.源码(后附使用说明) package com.zhiyou100.crm.util; /** * 分页功能 * @author YangXianSheng * */ public class Pa ...
- Struts2中解决表单重复提交
3. 表单的重复提交问题 1). 什么是表单的重复提交 > 在不刷新表单页面的前提下: >> 多次点击提交按钮 >> 已经提交成功, 按 "回退" ...
- Microsoft Excel 标题栏或首行锁定
Microsoft Excel 标题栏或首行锁定 在进行Excel编辑的时候,希望在浏览的时候,第一行或者第一列能够始终显示. 需要做的是:在Excel中选择 "视图"->& ...
- Cookies Client Identification
HTTP The Definitive Guide Cookies are the best current way to identify users and allow persistent se ...
- ES6中的let和const
let和const let 用来声明变量,但是所声明的变量只在let命令所在的代码块内有效 { let a=12 alert(a)//12 } alert(a)//报错 找不到 let不像var那样会 ...
- K线数据库表结构
-- -- 数据库: `bittrex` -- -- -------------------------------------------------------- -- -- 表的结构 `ltc` ...