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部电影,每个人都有一个快乐值.每场电影都有它的开始.结束时间和 ...
随机推荐
- matlab数值数据的表示方法,输出数据以及相关函数
数据类型的分类: 1.整型 无符号整型和带符号整形 带符号整形的最大值是127 >>x=int8(129) 输出结果是x=127 >>x=unit8(129) 输出结果是x=1 ...
- MHA的MySQL高可用方案实战
功能: 1)master的故障切换(keepalived VIP的飘移) 2)主从复制角色的提升和重新转向 其中master 对外提供写服务,备选master2(实际的slave提供读服务,slave ...
- Django - 视图获取请求头
1.urls.py(url和函数对应关系) 2.通过request.evniron,返回request的所有信息,用索引的方式,获取用户请求头信息. 3.也可以通过key,value方式,来展示请求头 ...
- Linux内核源码特殊用法
崇拜并且转载的: http://ilinuxkernel.com/files/5/Linux_Kernel_Source_Code.htm Linux内核源码特殊用法 1 前言 Linux内核源码主要 ...
- uvalive 3231
3231 - Fair ShareAsia - Seoul - 2004/2005You are given N processors and M jobs to be processed. Two ...
- Optimizing web servers for high throughput and low latency
转自:https://blogs.dropbox.com/tech/2017/09/optimizing-web-servers-for-high-throughput-and-low-latency ...
- 救济金发放(The Dole Queue, UVa 133)
n(n<20)个人站成一圈,逆时针编号为1-n.有两个官员,A从1开始逆时针数,B从n开 始顺时针数.在每一轮中,官员A数k个就停下来,官员B数m个就停下来(注意有可能两个 官员停在同一个人上) ...
- 00.Python中下划线的5种含义
转自这里 先放上 简短的"速查表",罗列了五种Python下划线模式的含义: 模式 举例 含义 单前导下划线 _var 命名约定,仅供内部使用.通常不会由Python解释器强行执行 ...
- Python - 模块(二)
目录 Python - 模块(二) re re下面的方法 logging os Python - 模块(二) re re模块提供了正则表达式的相关操作 主要字符介绍: . 通配符,除了换行符之外的任意 ...
- 洛谷 P1943 LocalMaxima_NOI导刊2009提高(1)
我们先考虑第i大数,比它大的数有(n-i)个,显然要使i是Local Maxima,比它大的数必须放在它后面,那么它是Local Maxima的期望是: 那么n个数中Local Maxima个数的期望 ...