hdu 1050 Moving Tables
2016-02-08 20:43
423 查看
http://acm.hdu.edu.cn/showproblem.php?pid=1050
简单的题目,就是求交叉的路线最多次数。
注意:
房间可能从大到小,也可能从小到大。
1和2属于同一个,2和3也是。。。。等等
简单的题目,就是求交叉的路线最多次数。
注意:
房间可能从大到小,也可能从小到大。
1和2属于同一个,2和3也是。。。。等等
#include<iostream> using namespace std; int n,m,a[405]; int main(){ int temp1, temp2; cin >> n; while (n--) { memset(a, 0, sizeof(a)); int max = 0; cin >> m; for (int i = 0; i < m; i++){ cin >> temp1 >> temp2; if (temp1>temp2){ int temp = temp1; temp1 = temp2; temp2 = temp; } if (!(temp1 % 2)) temp1 = temp1 - 1; if (temp2 % 2) temp2 = temp2 + 1; for (int j = temp1; j <= temp2; j++){ a[j]++; max = a[j] > max ? a[j] : max; } } cout << max*10 << endl; } return 0; }
相关文章推荐
- 使用Windows Live Writer离线写csdn博客
- MongoDB的简单操作
- 朴素贝叶斯分类器本质上是线性分类器
- Stanford 机器学习笔记 Week2
- 自动增长字段
- 动画之逐帧
- 水木社区上看到的一道概率题
- 水木社区上看到的一道概率题
- iPhone计步器
- bzoj1864 三色二叉树
- 装饰器与函数的多层嵌套
- AngularJS中的http拦截
- ANDROID_MARS学习笔记_S01_007Linear_layout嵌套与layout_weight的设置
- 【小白的CFD之旅】03 老蓝
- hdu1272 小希的迷宫
- bzoj4318 OSU!
- KMP
- Linux下安装webstorm
- ANDROID_MARS学习笔记_S01_006ImageView
- 功能测试(二)软件的易用性