POJ1083 Moving Tables
来源:互联网 发布:深度linux硬盘怎么分区 编辑:程序博客网 时间:2024/05/16 12:19
题目要求时间最少,即尽可能让占用不同走廊的桌子并行运行。
设置一数组:dp[200],初始化为0。记录每个走廊占用的次数,所用时间极为最大占用次数*10
代码:
#include <iostream>#include <cstdlib>#include <string>#include <algorithm>using namespace std;struct node { int start; int end;};bool cmp(int a, int b) { return a> b;}int main() { int T; int n; int sum; int tmp; node a[450]; int dp[250]; cin>> T; while(T--) { cin >> n; sum = 10; for(int i = 0; i < n; i++){ cin>> a[i].start>> a[i].end; if(a[i].start > a[i].end) { tmp = a[i].start; a[i].start = a[i].end; a[i].end = tmp; } } memset(dp, 0, sizeof(dp)); for(int j = 0; j < n; j++){ for(int i = (a[j].start-1)/2;i <= (a[j].end-1)/2; i++) { dp[i]++; } } sort(dp, dp+200, cmp); cout << dp[0]*10<< endl; }// system("pause"); return 0;}
- POJ1083 Moving Tables
- poj1083 Moving Tables
- POJ1083 Moving Tables
- POJ1083 Moving Tables
- POJ1083--Moving Tables
- POJ1083 Moving Tables
- poj1083:moving tables
- poj1083 Moving Tables
- poj1083 Moving Tables
- poj1083 Moving Tables
- [POJ1083]Moving Tables
- POJ1083-Moving Tables
- poj1083-Moving Tables-贪心
- POJ1083 Moving Tables
- [POJ1083]Moving Tables
- POJ1083-Moving Tables解题报告
- 【离散化】poj1083 Moving Tables
- POJ1083,Moving Tables,好纠结的题
- Ubuntu12.04安装GTK 界面设计
- MapReduce与遗传算法、MapReduce与粒子群算法结合与实现
- POJ1018 Communication System
- POJ1050 To the Max
- 20个数据库设计最佳实践
- POJ1083 Moving Tables
- POJ1088 滑雪
- POJ1125 Stockbroker Grapevine
- POJ1015 Jury Compromise
- ubuntu12.04下Hadoop单机版、集群搭建以及Hadoop常用指令
- VIM安装omnicppcomplete
- Linux中运行python实现错误日志定时报警
- vim常用命令
- 实现Scrapy的Demo