Poj 1083
来源:互联网 发布:网络小额贷款不想还了 编辑:程序博客网 时间:2024/06/04 17:56
// 也不知道这题是不是动态规划,好像不是,应该算是贪心。
/**
刚开始还以为这道题是图论什么的,
后来看别人的代码才发现原来如此简单,惭愧啊!
其实就是计算每节走廊被使用的重叠的次数,取其中的最大次数*10即为所求。
**/
#include <stdio.h>
#include <string.h>
int main()
{
int t, n, i, temp;
int from, to, a[401], max;
scanf("%d", &t);
while (t--)
{
memset(a, 0, sizeof(a));
scanf("%d", &n);
while (n--)
{
scanf("%d %d", &from, &to);
if (from > to) //此步骤容易忽略
{
temp = from;
from = to;
to = temp;
}
if (from%2 == 0) from--;
if (to%2 != 0) to++;
for (i=from; i<=to; i++)
{
a[i]++;
}
}
max = a[1];
for (i=2; i<=400; i++)
{
if (a[i] > max) max = a[i];
}
printf("%d/n", 10*max);
}
}
- poj 1083 & poj 1328
- POJ 1083
- Poj 1083
- POJ 1083
- POJ 1083
- poj 1083
- POJ-1083
- POJ 1083
- POJ 1083
- poj 1083
- POJ 1083
- POJ 1083
- poj 1083
- poj 1083
- POJ-1083
- poj 1083
- poj 1083
- poj 1083
- SQL Server数据库管理员必备:DBCC命令
- 不要一辈子靠技术生存
- asp.net常用的第三方控件
- poj 2503 Babelfish
- zoj 2932 The Seven Percent Solution(水水~)
- Poj 1083
- TCP/UDP简介
- 【Professional C# 读书笔记】(二)-----语言基础:继承,运算符,类型转换的杂七杂八
- char、 varchar、nchar、nvarchar的区别
- 博客开篇布道
- 使用NSun快速开发V1.5.4发布
- [转]百见不如一闻,谈谈怎样选购耳机
- 精选85条俏皮话
- 谁有LAMP网站开发黄金组合的PDF格式?