额...大意是你可以决定什么时候选课。然后呢。每五分钟只有一次机会选。每种课限制选课时间。问你能选到的课最多有多少、

感觉一点都不水。是自己太菜了吗?

 #include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
using namespace std; struct Node
{
int l, r;
} node[]; int cmp(Node a, Node b)
{
if (a.r != b.r) return a.r <b.r;
return a.l <= b.l;
} int main()
{
int n;
while(cin >> n)
{
if (n == ) break;
for (int i=; i<n; ++i)
{
cin >> node[i].l >> node[i].r;
}
sort(node, node+n, cmp);
int ans = ;
int vis[];
memset(vis, , sizeof(vis)); for (int i=; i<; ++i)
{
int st = i;
int tans = ;
memset(vis, , sizeof(vis));
//for (st=i; st<=node[n-1].r; st+=5)
while(st <= node[n-].r)
{
for (int j=; j<n; ++j)
{
if (vis[j]) continue;
if (node[j].l < st && node[j].r >= st)
{
//st += 5;
vis[j] = ;
tans += ;
break;
}
//st += 5;
}
st += ;
}
ans = max(ans, tans);
}
cout << ans << endl;
}
return ;
}

HDU 3697贪心的更多相关文章

  1. hdu 3697 贪心

    #include<stdio.h> #include<stdlib.h> #include<string.h> #define inf 0x3fffffff #de ...

  2. HDU 3697 Selecting courses(贪心)

    题目链接:pid=3697" target="_blank">http://acm.hdu.edu.cn/showproblem.php?pid=3697 Prob ...

  3. hdu 3697 10 福州 现场 H - Selecting courses 贪心 难度:0

    Description     A new Semester is coming and students are troubling for selecting courses. Students ...

  4. HDU 3697 Selecting courses 选课(贪心)

    题意: 一个学生要选课,给出一系列课程的可选时间(按分钟计),在同一时刻只能选一门课程(精确的),每隔5分钟才能选一次课,也就是说,从你第一次开始选课起,每过5分钟,要么选课,要么不选,不能隔6分钟再 ...

  5. HDU 3697 Selecting courses(贪心+暴力)(2010 Asia Fuzhou Regional Contest)

    Description     A new Semester is coming and students are troubling for selecting courses. Students ...

  6. hdu 3697 Selecting courses (暴力+贪心)

    Selecting courses Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 62768/32768 K (Java/Others ...

  7. Hdu 5289-Assignment 贪心,ST表

    题目: http://acm.hdu.edu.cn/showproblem.php?pid=5289 Assignment Time Limit: 4000/2000 MS (Java/Others) ...

  8. hdu 4803 贪心/思维题

    http://acm.hdu.edu.cn/showproblem.php?pid=4803 话说C++还卡精度么?  G++  AC  C++ WA 我自己的贪心策略错了 -- 就是尽量下键,然后上 ...

  9. hdu 1735(贪心) 统计字数

    戳我穿越:http://acm.hdu.edu.cn/showproblem.php?pid=1735 对于贪心,二分,枚举等基础一定要掌握的很牢,要一步一个脚印走踏实 这是道贪心的题目,要有贪心的意 ...

随机推荐

  1. Salty Fish 结对学习心得体会及创意照 (20165211 20165208)

    小组结对学习心得体会及创意照 在阅读了软件工程讲义 3 两人合作(2) 要会做汉堡包和现代软件工程讲义 3 结对编程和两人合作后,加之对于这几周组队学习的感悟,我们对于组队学习的一些感悟和想法如下: ...

  2. mac OSX 实用快捷键

    Command + shift + G. 前往文件夹 按键 效果 Shift + option + 音量+/- 以四分之一的刻度加 / 减音量 Shift. + option + 9 ······

  3. VC++ 文件和应用程序关联,默认图标不显示问题

  4. 字符串分割(C++)(转载)

    转载出自:http://www.cnblogs.com/MikeZhang/archive/2012/03/24/MySplitFunCPP.html 经常碰到字符串分割的问题,这里总结下,也方便我以 ...

  5. How do I update a GitHub forked repository?

    I recently forked a project and applied several fixes. I then created a pull request which was then ...

  6. BZOJ2982: combination Lucas

    Description LMZ有n个不同的基友,他每天晚上要选m个进行[河蟹],而且要求每天晚上的选择都不一样.那么LMZ能够持续多少个这样的夜晚呢?当然,LMZ的一年有10007天,所以他想知道答案 ...

  7. php能干什么?

    什么是cookies 简单的说,Cookie就是服务器暂存放在你计算机上的一笔资料,好让服务器用来辨认你的计算机.当你在浏览网站的时候,Web服务器会先送一小小资料放在你的计算机上,Cookie 会帮 ...

  8. [Err] 1111 - Invalid use of group function

    本文为博主原创,未经允许不得转载: 初衷,本想通过group by sql语句查询出不同id下总数在一定范围内的数据,所以产生如下的sql,及错误sql AND STATDATE < ' GRO ...

  9. mysql 开启远程访问

    # vi /etc/mysql/my.cnf修改 bind-address = 127.0.0.1  为  bind-address = 0.0.0.0 修改完成后重启mysql服务 # sudo / ...

  10. Springboot 学习笔记 之 Day 4 笔记部分

    spring-boot-starter 核心Spring Boot starter,包括自动配置支持,日志和YAMLspring-boot-starter-actuator 生产准备的特性,用于帮你监 ...