[HDU5214]Movie解题报告|小水题大智慧
Movie
Cloud and Miceren like watching movies.Today, they want to choose some wonderful scenes from a movie. A movie has N scenes can be chosen, and each scene is associate with an interval [L, R]. L is the beginning time of the scene and R is the ending time. However, they can't choose two scenes which have overlapping intervals. (For example, scene with [1, 2] and scene with [2, 3], scene with [2, 5] and scene with[3, 4]).
Now, can you tell them if they can choose such three scenes that any pair of them do not overlap?
Since there are so many scenes that you can't get them in time, we will give you seven parameters N, L1, R1, a, b, c, d, and you can generate L1 ~ LN, R1 ~ RN by these parameters.

#include<cstdio>
#include<cstdlib>
#include<cstring>
const int maxn = ;
unsigned int l[maxn],r[maxn];
int main(){
int test;
scanf("%d",&test);
while (test--){
unsigned int n,a,b,c,d,tem;
scanf("%d%d%d%d%d%d%d",&n,&l[],&r[],&a,&b,&c,&d);
for (int i=;i<=n;i++) l[i]=l[i-]*a+b,r[i]=r[i-]*c+d;
for (int i=;i<=n;i++) if (l[i]>r[i]){tem=l[i];l[i]=r[i];r[i]=tem;}
unsigned int x=r[],y=l[];
for (int i=;i<=n;i++){
if (r[i]<x) x = r[i];
if (l[i]>y) y = l[i];
}
int flag = ;
for (int i=;i<=n;i++) if (l[i]>x&&r[i]<y) flag = ;
if (flag) printf("YES\n");else printf("NO\n");
}
return ;
}
[HDU5214]Movie解题报告|小水题大智慧的更多相关文章
- hdu5007 小水题
题意: 给你一个串,如果出现子串 "Apple", "iPhone", "iPod", "iPad"输出MA ...
- hdu 4540 威威猫系列故事——打地鼠 dp小水题
威威猫系列故事——打地鼠 Time Limit: 300/100 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others) Total ...
- hdu 4524 郑厂长系列故事——逃离迷宫 小水题
郑厂长系列故事——逃离迷宫 Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others) To ...
- POJ 1013 小水题 暴力模拟
Counterfeit Dollar Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 35774 Accepted: 11 ...
- Codeforces441A_Valera and Antique Items(水题)
Valera and Antique Items time limit per test 1 second memory limit per test 256 megabytes input stan ...
- 2011 ACM-ICPC 成都赛区解题报告(转)
2011 ACM-ICPC 成都赛区解题报告 首先对F题出了陈题表示万分抱歉,我们都没注意到在2009哈尔滨赛区曾出过一模一样的题.其他的话,这套题还是非常不错的,除C之外的9道题都有队伍AC,最终冠 ...
- Codeforces 524 解题报告
打的很快乐的一次比赛hiahiahia, 才A掉4题rating就涨了100+ 距离比赛\(3\)天了, 由于博主实在太颓, 又补掉了\(E\)题, 到现在才发解题报告 A. 语法题, 读入输出就行了 ...
- LeetCode 2 Add Two Sum 解题报告
LeetCode 2 Add Two Sum 解题报告 LeetCode第二题 Add Two Sum 首先我们看题目要求: You are given two linked lists repres ...
- UVa 272 Tex Quotes --- 水题
题目大意:在TeX中,左引号是 ``,右引号是 ''.输入一篇包含双引号的文章,你的任务是把他转成TeX的格式 解题思路:水题,定义一个变量标记是左引号还是右引号即可 /* UVa 272 Tex Q ...
随机推荐
- 第八次作业——项目UML设计
分工及贡献分评定 成员 参与 贡献比例 朱跃安(031602348) 类图 13% 后敬甲(031602409) 实体关系图+博客整理 14.5% 林志华(031602128) 用例图+活动图 14. ...
- Css入门课程 Css基础
html css javascript三者关系 html是网页内容的载体 css是网页内容的表现,外观控制 javascript是网页逻辑处理和行为控制 css相对于html标签属性的优势 css简化 ...
- C# Dsoframer.ocx 如何在winform中嵌入Excel,内嵌Excel,word
如果你还不太清楚Dspframer.ocx怎么放到窗体上就看上一篇文章,里面详细介绍了是如何放到窗体上的. 链接:http://www.cnblogs.com/pingming/p/4182045.h ...
- TCP/IP协议与OSI协议
OSI协议是一个理想化的协议,它把网络传输过程分为七层模型,以达到形象化的理解的效果,在实际应用中没有被使用.TCP/IP协议可以看作是它的简化版,是目前应用最广泛的网络协议,许多协议都是以它为基础而 ...
- 在DBGrid中可选中行而又可进入编辑状态
如何在DBGrid中选中行,而又让它可以进入编辑状态? 也许你会问我这有什么用?呵呵,做数据库应用的兄弟们会深有感触,当用DBGrid显示的字段过多时,用户不得不拉动最下面的滚动条,去看最右边的东西, ...
- fzu1686-神龙的难题
给出一个n\times m的01矩阵,以及\(h,w\),表示一次可以把矩阵的一个\(h\times w\)的小矩阵变为全0,问至少要多少次可以把整个矩阵变为全0.\(n,m\le 15\). 分析 ...
- CenOS shell脚本
1.先查看脚本解释器 [es@bigdata-senior01 ~]$ echo $SHELL /bin/bash 2.编写最简单的脚本 vi test.sh#第一行的脚本声明(#!)用来告诉系统使用 ...
- 【QQ】前端实现QQ会话功能
<a href="tencent://message/?uin=客服QQ号码&Menu=yes" target="blank"></a ...
- MySQL中数据表的基本操纵
本文基于对国家863中部软件孵化器编著的<MySQL从入门到精通>一书的操作实践. 一.创建数据表 数据表属于数据库,在创建数据表之前,应该使用语句 USE 数据库名 指定操作是在那个 ...
- YBT 5.3 数位动态规划
记忆化搜索的专题 题解在代码中 Amount of Degrees[loj 10163] /* 此题可以转换成将10进制转成b进制后有k个1其他都为0的个数 所以用记忆化dfs dp[pos][sum ...