题意:

要求找到最少次数的交换次数使得两组数都是偶数;

很明显答案要么是0,要么是1,或者不管怎么交换都不行(-1);

所以:

 #include<cstdio>
#define maxn 105
using namespace std; int n,x,y; int main()
{
scanf("%d",&n);
int a=,b=,c=;
while(n--)
{
scanf("%d%d",&x,&y);
a+=x,b+=y;
c+=(y%)!=(x%);
}
if(a%==&&b%==)puts("");
else if(c%==&&c>)puts("");
else puts("-1");
return ;
}

Codeforces Round #205 (Div. 2) : A的更多相关文章

  1. Codeforces Round #205 (Div. 2)C 选取数列可以选择的数使总数最大——dp

    http://codeforces.com/contest/353/problem/C Codeforces Round #205 (Div. 2)C #include<stdio.h> ...

  2. Codeforces Round #205 (Div. 2)

    A #include <iostream> #include<cstdio> #include<cstring> #include<algorithm> ...

  3. Codeforces Round #205 (Div. 2) : D

    思维题,感叹自己的智商不够啊. 思路大概是这样的: 1.排在队伍前面的女生是不用换位置的: 2.女生在队伍中的顺序是不会变的: 3.最后一个女生稳定了则程序结束: 4.每个女生都有个初始位置和最终位置 ...

  4. Codeforces Round #205 (Div. 2) : C

    感觉像是一个数位dp,高位的1如果不选的话,前面低位的数都可以选:不然只能选择为1的数: 代码: #include<iostream> #include<algorithm> ...

  5. Codeforces Round #205 (Div. 2) : B

    如果某个数出现的次数大于或等于2次,那么平均分配到两个容器里面: 这里利用一个k来使得当出现次数为奇数时候分配得更加均匀: 剩下的就平均分配到两个容器里: 代码: #include<iostre ...

  6. Codeforces Round 536 (Div. 2) (E)

    layout: post title: Codeforces Round 536 (Div. 2) author: "luowentaoaa" catalog: true tags ...

  7. Codeforces Round #506 (Div. 3) D-F

    Codeforces Round #506 (Div. 3) (中等难度) 自己的做题速度大概只尝试了D题,不过TLE D. Concatenated Multiples 题意 数组a[],长度n,给 ...

  8. Codeforces Round #608 (Div. 2) 题解

    目录 Codeforces Round #608 (Div. 2) 题解 前言 A. Suits 题意 做法 程序 B. Blocks 题意 做法 程序 C. Shawarma Tent 题意 做法 ...

  9. Codeforces Round #579 (Div. 3)

    Codeforces Round #579 (Div. 3) 传送门 A. Circle of Students 这题我是直接把正序.逆序的两种放在数组里面直接判断. Code #include &l ...

随机推荐

  1. Load resources from classpath in Java--reference

    In general classpath is the path where JVM can find .class files and resources of your application a ...

  2. Android开发之View重写相关API-onLayout,onMeasure,MeasureSpec

     1.onLayout android.view.ViewGroup protected void onLayout(boolean changed, int l, int t, int r, int ...

  3. Android(java)学习笔记186:对ListView等列表组件中数据进行增、删、改操作

    1.ListView介绍 解决大量的相似的数据显示问题 采用了MVC模式: M: model (数据模型) V:  view  (显示的视图) C: controller 控制器 入门案例: acit ...

  4. Linux如何卸载挂载文件

    在我们进行远程文件操作的时候,我们经常会出现文件服务出现卸载掉哦情况.例如 umount /mnt/net1umount: /mnt/net1: device is busy.        (In ...

  5. SharePoint SiteCollection Administrator

    到网上去找怎么取到一个站点的sitecollection  Administrator, 如果设置了一个站点的 sitecollection  Administrator, 那么通过: SPSite ...

  6. dynamic 和var

    dynamic,编译后被转换成带有 dynamicAttribute的object对象,可用在方法参数,返回值活或者局部变量上 执行过程: 运行时绑定首先会检查是否继承IDynamicMetaObje ...

  7. jmeter压测app

    使用代理的方式,录制app端脚本,之后用jmeter压测就没啥好说的了 1.电脑端谷歌设置本地代理(端口号为8888) 2.jmeter设置HTTP代理服务器(端口号为8888) 3.手机端wifi设 ...

  8. 尽量不要用select into 复制表

    select into 复制表会带来灾难后果,因为只是复制了一个外壳,就像克隆人,有躯体没意识,像原表的主键 外键 约束 触发器 索引都不会被复制过来, 创建一个表:CREATE TABLE [dbo ...

  9. Hibernate session flush

    最近做项目时,用到了hibernnate,批量删除10000条数据时,删除时前台将id传到后台,用in匹配去删除,页面直接卡死. 解决方法,将传过来的10000条id分批删除,每删除五百条后,调用ge ...

  10. Oracle 检验身份证是否正确的存储过程

    ) ) ); ); ); ); ); ); ); ; , , , , , , , , , , , , , , , , , ); ;  , ) );  ..  loop )) ) ); , )), ), ...