WHOJ 1606 - Funny Sheep【水】
2016-04-10 12:59
477 查看
Problem 1606 - Funny Sheep
Time Limit: 1000MS Memory Limit: 65536KB
Total Submit: 616 Accepted: 172 Special Judge: No
Description
There are N+1 rows and M+1 columns fence with N*M grids on the grassland. Each grid has a sheep. In order to let the sheep together, we need to dismantle the fence. Every time you can remove a row or a column of fences. What’s the least number of times to
reach the goal?
Input
There are multiple test cases.
The first line of each case contains two integers N and M. (1≤N,M≤1000)
Output
For each case, output the answer in a line.
Sample Input
1 2
2 2
Sample Output
1
2
AC-code:
Time Limit: 1000MS Memory Limit: 65536KB
Total Submit: 616 Accepted: 172 Special Judge: No
Description
There are N+1 rows and M+1 columns fence with N*M grids on the grassland. Each grid has a sheep. In order to let the sheep together, we need to dismantle the fence. Every time you can remove a row or a column of fences. What’s the least number of times to
reach the goal?
Input
There are multiple test cases.
The first line of each case contains two integers N and M. (1≤N,M≤1000)
Output
For each case, output the answer in a line.
Sample Input
1 2
2 2
Sample Output
1
2
AC-code:
#include<cstdio> int main() { int n,m; while(~scanf("%d%d",&m,&n)) { if(m==n&&n==1) { printf("0\n"); } else printf("%d\n",n<m?n:m); } return 0; }
相关文章推荐
- 学习编程经典书籍
- 神经单元
- 欢迎使用CSDN-markdown编辑器
- myeclipse如何修改Web项目名称
- 九度 1010
- 使用Google浏览器必备的插件
- Two Sum(初谈双指针)
- nmon结果分析
- android中对输入手机号码有效性验证(是否为正确的手机号码)
- 将非Maven管理的jar打包到Maven本地资源库
- Maven3 --- Eclipse集成Maven
- 组合数
- Sharepoint 构建轻量型应用之传出电子邮件设置!
- Linux内核分析——可执行程序的装载
- android入门之使用adb shell 查看data目录下的SQLite数据库
- ConcurrentModificationException异常
- Android权限
- WaitForMultipleObjects使用详解
- 3最短路的几种解法 ------例题< 最短路 >
- Unity UGUI图文混排源码(二)