2015 多校赛 第三场 1002 (hdu 5317)
Description
Input
In the next T lines, each line contains L, R which is mentioned above.
All input items are integers.
1<= T <= 1000000
2<=L < R<=1000000
Output
See the sample for more details.
Sample Input
Sample Output
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
#define maxn 1000005
int t,l,r,F[maxn],num[maxn][],cnt[],ans;
void init(){
for(int i=;i<=;i++){
if(F[i]==){
for(int j=i<<;j<=;j+=i)
F[j]++;
F[i]=;
}
}
for(int i=;i<=;i++){
for(int j=;j<=;j++){
num[i][j]=num[i-][j];
if(F[i]==j) num[i][j]++;
}
}
}
int main(){
init();
scanf("%d",&t);
while(t--){
ans=;
scanf("%d%d",&l,&r);
for(int i=;i<=;i++){
cnt[i]=num[r][i]-num[l-][i];
if(cnt[i]>) ans=i;
}
if(cnt[]&&cnt[]) ans=max(ans,);
if(cnt[]&&cnt[]) ans=max(ans,);
if(cnt[]&&cnt[]) ans=max(ans,);
if(cnt[]&&cnt[]) ans=max(ans,);
printf("%d\n",ans);
}
return ;
}
2015 多校赛 第三场 1002 (hdu 5317)的更多相关文章
- 2015 多校赛 第五场 1010 (hdu 5352)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5352 看题看得心好累. 题目大意: 给出 n 个点,依次执行 m 次操作:输入“1 x”时,表示将与 ...
- 2015 多校赛 第七场 1011 (hdu 5379)
题意:给定一棵树,树上有 n 个节点.问有多少种方案,使得在每个节点上依次放置数 1~n 后,每个节点的儿子节点上的数连续(比如 1 为根,有1-2,1-3,1-4,则令2,3,4上的数连续),每个子 ...
- 2015 多校赛 第五场 1006 (hdu 5348)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5348 题目大意:给出一幅无向图,问是否存在一种方案,使得给每条边赋予方向后,每个点的入度与出度之差小于 ...
- 2015 多校赛 第四场 1010 (hdu 5336)
Problem Description XYZ is playing an interesting game called "drops". It is played on a r ...
- 2015 多校赛 第四场 1009 (hdu 5335)
Problem Description In an n∗m maze, the right-bottom corner is the exit (position (n,m) is the exit) ...
- hdu 5319 Painter(杭电多校赛第三场)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5319 Painter Time Limit: 2000/1000 MS (Java/Others) ...
- hdu 5326 Work(杭电多校赛第三场)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5326 Work Time Limit: 2000/1000 MS (Java/Others) M ...
- NOI.AC NOIP模拟赛 第三场 补记
NOI.AC NOIP模拟赛 第三场 补记 列队 题目大意: 给定一个\(n\times m(n,m\le1000)\)的矩阵,每个格子上有一个数\(w_{i,j}\).保证\(w_{i,j}\)互不 ...
- 【杂题总汇】HDU多校赛第十场 Videos
[HDU2018多校赛第十场]Videos 最后一场比赛也结束了…… +HDU传送门+ ◇ 题目 <简要翻译> 有n个人以及m部电影,每个人都有一个快乐值.每场电影都有它的开始.结束时间和 ...
随机推荐
- 最小生成树算法Kruskal详解
要讲Kruskal,我们先来看下面一组样例. 4 5 1 2 3 1 4 5 2 4 7 2 3 6 3 4 8 14 画出来更直观一些,就是上面的这张图. 智商只要不是0的(了解最小生成树是什么的童 ...
- Vim 写 C/C++ 的配置
.vimrc 2018/08/08 更新 基本的配置,缩进显示行号等 给每个 C/C++ 文件添加头部,显示作者,文件创建时间 F5 编译执行 C/C++源代码 Ctrl + F 利用用 astyle ...
- java 常见问题
1.Cannot convert value '0000-00-00 00:00:00' from column 1 to TIMESTAMP 2.怎么解决BigDecimal里面无限循环小数的问题啊 ...
- mysql-索引、导入、导出、备份、恢复
1.索引 索引是一种与表有关的结构,它的作用相当于书的目录,可以根据目录中的页码快速找到所需的内容. 当表中有大量记录时,若要对表进行查询,没有索引的情况是全表搜索:将所有记录一一取出,和查询条件进行 ...
- bootstrap下的双选时间插件使用方法
bootstrap画的页面很漂亮,能自动适应网页端,移动端.实现一个双选时间控件: 要得jar包自己去下 一.页面 二.JS var $createTime=$('#createTime');$cre ...
- python 多个相同字符串
1.相同字符串str,重复打印n次. str=str*n 2.填充字符串str为指定宽度n,左边填充0. str.zfill(n)
- java.lang.ClassFormatError: Unknown constant tag 0 in class file
在通过文件上传之后,运行java程序,突然发现这么一个错误:java.lang.ClassFormatError: Unknown constant tag 0 in class file,通过网上查 ...
- kendo Grid的toolbar自定义
由于这个toolbar官方进增加了create,save还有一个是_____ 所以想要自定义话就需要使用 下面的代码(这个是MVVM模式) data-toolbar='[{ template: Ken ...
- .net performance optimize your C# app 读书笔记
目录 序 作者简介 推荐人简介 感谢 本书简介 第一章 性能指标 第二章 性能测量 第三章 内部类型 第四章 垃圾回收机制 第五章 集合和泛型 第六章 并发和并行性 第七章 网络.I / ...
- CF #324 DIV2 E题
这题很简单,把目标位置排序,把目标位置在当前位置前面的往前交换,每次都是贪心选择第一个满足这样要求的数字. #include <iostream> #include <cstdio& ...