注意:横向纵向交叉时,只要两条边不是正中的边(当n&1!=1),就可以余下两个chip。

代码里数组a[][]第二维下标 0表示横向边,1表示纵向边。

 #include<stdio.h>
#include<string.h> int a[][]; int main()
{
int n,m,i,j,x,y;
scanf("%d%d",&n,&m);
for(i=;i<n;i++)
{
a[i][]=a[i][]=;
}
for(i=;i<m;i++)
{
scanf("%d%d",&x,&y);
a[x][]=a[y][]=;
}
int s=;
for(i=;i<=n/;i++)
{
s+=a[i][]+a[i][]+a[n-i+][]+a[n-i+][];
}
if(n&){
if(a[(n+)/][]+a[(n+)/][]>)
s++;
}
printf("%d\n",s);
return ;
}

codeforces 333B - Chips的更多相关文章

  1. Chips CodeForces - 333B

    Chips CodeForces - 333B 题意:有一个n*n的棋盘,其中有m个格子被禁止.在游戏开始前要将一些芯片(?)放到四条边上(但不能是角上).游戏开始后,每次操作将每一个芯片移动到它四周 ...

  2. Codeforces 1511G - Chips on a Board(01trie/倍增)

    Codeforces 题面传送门 & 洛谷题面传送门 一道名副其实的 hot tea 首先显然可以发现这俩人在玩 Nim 游戏,因此对于一个 \(c_i\in[l,r]\) 其 SG 值就是 ...

  3. Codeforces 1244F. Chips

    传送门 显然可以注意到连续的两个相同颜色的位置颜色是不会改变的,并且它还会把自己的颜色每秒往外扩展一个位置 同时对于 $BWBWBW...$ 这样的序列,它每个位置的颜色每一秒变化一次 然后可以发现, ...

  4. cf 333b

    G - Chips Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit S ...

  5. Mango Weekly Training Round #3 解题报告

    A. Codeforces 92A Chips 签到题.. #include <iostream> #include <cstdio> #include <cstring ...

  6. Codeforces Round #194 (Div. 1) B. Chips 水题

    B. Chips Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/333/problem/B D ...

  7. Codeforces Round #194 (Div. 2) D. Chips

    D. Chips time limit per test:1 second memory limit per test:256 megabytes input:standard input outpu ...

  8. Codeforces Round #582 (Div. 3) A. Chips Moving

    传送门 题解: 给你n个数的坐标,你需要把他们移动到一个位置,有两种移动方式 1.向左或者右移动2 2.向左或者右移动1,但是耗费1 求最小耗费 题解: 很简单就可以想到,看一下偶数坐标多还是奇数坐标 ...

  9. CodeForces 176C Playing with Superglue 博弈论

    Playing with Superglue 题目连接: http://codeforces.com/problemset/problem/176/C Description Two players ...

随机推荐

  1. spoj 375 Query on a tree(树链剖分,线段树)

      Query on a tree Time Limit: 851MS   Memory Limit: 1572864KB   64bit IO Format: %lld & %llu Sub ...

  2. C# 生成MD5编码方法(不同位数)

    /// <summary>          /// </summary>          /// <param name="strSource"& ...

  3. uva 11609

    可以想到 答案为 1*C(1,n)+2*C(2,n)+3*C(3,n)+....+n*C(n,n); 由公式 k*C(k,n) = n*C(k-1,n-1) 所以最终答案 n*2^(n-1) 用到快速 ...

  4. tomcat 解析(五)-Tomcat的核心组成和启动过程

    声明:源码版本为Tomcat 6.0.35 前面的文章中介绍了Tomcat的基本配置,每个配置项也基本上对应了Tomcat的组件结构,如果要用一张图来形象展现一下Tomcat组成的话,整个Tomcat ...

  5. 如何用 OneAPM 优化你的 Node.js 应用?

    本文主要讲解如何使用 OneAPM 提供的信息从内存.CPU 使用.响应速度等方面优化 Node.js 应用.适用于定位于刚刚使用 Node.js 开发后台的读者.本文系 OneAPM 用户投稿,本网 ...

  6. POJ 2253 Frogger(floyd)

    http://poj.org/problem?id=2253 题意 : 题目是说,有这样一只青蛙Freddy,他在一块石头上,他呢注意到青蛙Fiona在另一块石头上,想去拜访,但是两块石头太远了,所以 ...

  7. POJ1008Maya Calendar

    http://poj.org/problem?id=1008&lang=default&change=true 这个题倒是不难,就是麻烦一点,但是还WA了几次都是因为处理天数的时候没处 ...

  8. hdu 1275 两车追及或相遇问题

    思路:这里有2种情况: 一种是相遇:满足关系是 (va+vb)*t=L*(2*n-1) 一种是追及: 满足关系是 |va-vb|*t=L*(2*n-1) 这样求出2种情况的时间,在排序就可以了…… 链 ...

  9. CAS(Compare and Swap)理解

    什么叫CAS(Compare and Swap)?  硬件同步原语!! 什么蛋疼的名字,一般人很难理解.根据英文全称翻译==比较与交换,这个名字大致还能理解一点,目前先暂且这么理解吧. 有啥用处? 对 ...

  10. spring 与 CXF 整合 webservice 出现error “Unable to locate Spring NamespaceHandler for XML schema namespace” 总结

    我试了多个版本的spring 发现 出现error : Unable to locate Spring NamespaceHandler for XML schema namespace 并非都是sp ...