zoukankan      html  css  js  c++  java
  • codeforces 333B

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

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

     1 #include<stdio.h>
     2 #include<string.h>
     3 
     4 int a[1111][2];
     5 
     6 int main()
     7 {
     8     int n,m,i,j,x,y;
     9     scanf("%d%d",&n,&m);
    10     for(i=2;i<n;i++)
    11     {
    12         a[i][0]=a[i][1]=1;
    13     }
    14     for(i=0;i<m;i++)
    15     {
    16         scanf("%d%d",&x,&y);
    17         a[x][0]=a[y][1]=0;
    18     }
    19     int s=0;
    20     for(i=2;i<=n/2;i++)
    21     {
    22             s+=a[i][0]+a[i][1]+a[n-i+1][0]+a[n-i+1][1];
    23     }
    24     if(n&1){
    25         if(a[(n+1)/2][0]+a[(n+1)/2][1]>0)
    26             s++;
    27     }
    28     printf("%d
    ",s);
    29     return 0;
    30 }
    View Code
  • 相关阅读:
    2019年4月18日 查询功能 2
    bzoj3601
    bzoj2693
    bzoj2440
    bzoj3529
    bzoj2820
    BZOJ2813
    BZOJ4515
    AtCoder Grand Contest 001 题解
    BZOJ2757
  • 原文地址:https://www.cnblogs.com/zstu-abc/p/3220224.html
Copyright © 2011-2022 走看看