nyoj 220 推桌子
来源:互联网 发布:薛之谦胡彦斌 知乎 编辑:程序博客网 时间:2024/04/27 21:55
题目来源:http://acm.nyist.net/JudgeOnline/problem.php?pid=220
之前做过类似的题,求出最大的区间重叠次数,以为还是一样呢,没细看就敲了,结果wa了!两排房子是并行的,要化成一排!
#include <iostream>#include <cstdio>#include <cstring>#include <cmath>using namespace std;int MAX(int a, int b){return a > b ? a : b;}int main(){int T, n, i, j, a, b, ans;int arr[410];scanf("%d", &T);while (T--){scanf("%d", &n);memset(arr, 0, sizeof(arr));ans = 0;for (i = 0; i < n; ++i){scanf("%d %d", &a, &b);a = (a+1) >> 1;//别忘记房间是并行的,1-2,3-4, 5-6都是对等的,这里需要转化一下,化成一排!这里没主意害得我wa了一次b = (b+1) >> 1;if(a > b){a ^= b;b ^= a;a ^= b;}for (j = a; j <= b; ++j){arr[j]++;ans = MAX(arr[j], ans);}}printf("%d\n", ans*10);}return 0;}
0 0
- NYOJ-220-推桌子
- NYOJ 220 推桌子
- nyoj 220 推桌子
- NYOJ 220 推桌子
- NYOJ-220 推桌子
- NYOJ 220 推桌子
- nyoj-220 推桌子
- nyoj 220 推桌子
- nyoj 220 推桌子
- NYOJ 220 推桌子
- hdu nyoj 220 推桌子
- nyoj 220 推桌子 poj 1083
- NYOJ 220 推桌子(贪心)
- NYOJ 220 推桌子(贪心算法)
- nyoj 题目220 推桌子 贪心算法
- hdu 1050 Moving Tables && nyoj 220 推桌子
- 推桌子nyoj 220&&hdu1050 (贪心算法系列)
- hdoj 1050 Moving Tables && nyoj 220 推桌子 (经典贪心)
- 图的邻接矩阵的建立以及遍历
- (2014)编程之美初赛第一场
- 纯css3响应式3d翻转菜单
- Ubuntu x86 64 settup nginx rtmp server
- mysql内存使用分析
- nyoj 220 推桌子
- 设备IO
- leetcode第一刷_Binary Tree Postorder Traversal
- linux几个经常使用的命令
- 日版(SoftBank, AU) iPhone5回国使用攻略调查
- 梅州“天华专区-高清影院-动作战争”《英雄本色3》《低俗小说》无法点播。此影片在中心试没有的,在地市正常状态也应该是没有的,但是梅州还在上架里。
- Linux设备驱动模型之platform总线
- 面向 Java 开发人员的 Ajax: 构建动态的 Java 应用程序
- Linux/Unix下的命令扩展