#include<stdio.h>

#define N 60

int map[N][N];

int main() {

 int n,m,i,j,flag;

 while(scanf("%d%d",&n,&m)!=EOF) {

  flag=0;

  for(i=1;i<=n;i++)

   for(j=1;j<=m;j++) {

    scanf("%d",&map[i][j]);

    if(map[i][j]&&(i==1||j==1||i==n||j==m))

     flag=1;

   }

   if(flag)

    printf("2\n");

   else

    printf("4\n");

 }

 return 0;

}

codeforces 359A的更多相关文章

  1. python爬虫学习(5) —— 扒一下codeforces题面

    上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...

  2. 【Codeforces 738D】Sea Battle(贪心)

    http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n g ...

  3. 【Codeforces 738C】Road to Cinema

    http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants ...

  4. 【Codeforces 738A】Interview with Oleg

    http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interv ...

  5. CodeForces - 662A Gambling Nim

    http://codeforces.com/problemset/problem/662/A 题目大意: 给定n(n <= 500000)张卡片,每张卡片的两个面都写有数字,每个面都有0.5的概 ...

  6. CodeForces - 274B Zero Tree

    http://codeforces.com/problemset/problem/274/B 题目大意: 给定你一颗树,每个点上有权值. 现在你每次取出这颗树的一颗子树(即点集和边集均是原图的子集的连 ...

  7. CodeForces - 261B Maxim and Restaurant

    http://codeforces.com/problemset/problem/261/B 题目大意:给定n个数a1-an(n<=50,ai<=50),随机打乱后,记Si=a1+a2+a ...

  8. CodeForces - 696B Puzzles

    http://codeforces.com/problemset/problem/696/B 题目大意: 这是一颗有n个点的树,你从根开始游走,每当你第一次到达一个点时,把这个点的权记为(你已经到过不 ...

  9. CodeForces - 148D Bag of mice

    http://codeforces.com/problemset/problem/148/D 题目大意: 原来袋子里有w只白鼠和b只黑鼠 龙和王妃轮流从袋子里抓老鼠.谁先抓到白色老鼠谁就赢. 王妃每次 ...

随机推荐

  1. 数组声明的几种方式以及length属性

    声明一: int[] arr=new int[10]; for(int i=0;i<arr.length;i++){ arr[i]=i; } 声明二: int[] arr2={1,2,3}; 声 ...

  2. E. Comments dfs模拟

    http://codeforces.com/contest/747/problem/E 首先,把字符串变成这个样子. hello,2,ok,0,bye,0,test,0,one,1,two,2,a,0 ...

  3. absolute元素水平居中

    原始(未居中): .con{ width:200px; height:200px; background:#ccc; position:relative; } .abs{ width:40px; he ...

  4. CCF|路径解析|Java

    import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in=ne ...

  5. mysql 判断字符串是否为其他字符串的子集

    1.mysql 提供单个用逗号隔开判断某个字符串是否包含在其他字符串的之内:FIND_IN_SET('需要匹配的字符串','源字符串'); demo: select FIND_IN_SET('111' ...

  6. 源代码管理git的使用

    Git ----本地仓库---- 1.新建一个“本地仓库” git init 2.配置仓库 ①告诉git你是谁 git config user.name syl ②告诉git怎么联系你 git con ...

  7. 从0开始搭建SQL Server 2012 AlwaysOn 第一篇(AD域与DNS)

    随着业务发展,公司需要提高数据安全与性能需求,所以需要对新技术预研(先采坑),做技术积累: 了解相关AlwaysOn 故障转移集群(热备),数据路由(ICX),Moebius(莫比斯数据路由) 决定测 ...

  8. 最近面试oracle 数据库的知识点

    1. Oracle跟SQL Server 2005的区别? 宏观上: 1). 最大的区别在于平台,oracle可以运行在不同的平台上,sql server只能运行在windows平台上,由于windo ...

  9. CentOS 7 安装Oracle VirtualBox

    1. 下载VirtualBox的repo文件: 登陆 https://www.virtualbox.org/wiki/Linux_Downloads 在网页的最下端的repo链接上右键下载,或者wge ...

  10. (转)淘淘商城系列——发布dubbo服务

    http://blog.csdn.net/yerenyuan_pku/article/details/72758639 Dubbo采用全Spring配置方式,透明化接入应用,对应用没有任何API侵入, ...