CF-805A
A. Fake NPtime limit per test1 second
memory limit per test256 megabytes
inputstandard input
outputstandard output
Tavak and Seyyed are good friends. Seyyed is very funny and he told Tavak to solve the following problem instead of longest-path.
You are given l and r. For all integers from l to r, inclusive, we wrote down all of their integer divisors except 1. Find the integer that we wrote down the maximum number of times.
Solve the problem to show that it's not a NP problem.
InputThe first line contains two integers l and r (2 ≤ l ≤ r ≤ 109).
OutputPrint single integer, the integer that appears maximum number of times in the divisors.
If there are multiple answers, print any of them.
Examplesinput19 29output2input3 6output3NoteDefinition of a divisor: https://www.mathsisfun.com/definitions/divisor-of-an-integer-.html
The first example: from 19 to 29 these numbers are divisible by 2: {20, 22, 24, 26, 28}.
The second example: from 3 to 6 these numbers are divisible by 3: {3, 6}.
题意:
求从 l 到 r 出现的最多的因数。
每两个数就会有一个因数2,所以若非 l==r ,
则2为出现次数最多的。
附AC代码:
#include<bits/stdc++.h>
using namespace std; int main(){
int l,r;
cin>>l>>r;
if(l==r)
cout<<l<<endl;
else
cout<<<<endl;
return ;
}
CF-805A的更多相关文章
- ORA-00494: enqueue [CF] held for too long (more than 900 seconds) by 'inst 1, osid 5166'
凌晨收到同事电话,反馈应用程序访问Oracle数据库时报错,当时现场现象确认: 1. 应用程序访问不了数据库,使用SQL Developer测试发现访问不了数据库.报ORA-12570 TNS:pac ...
- cf之路,1,Codeforces Round #345 (Div. 2)
cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅..... ...
- cf Round 613
A.Peter and Snow Blower(计算几何) 给定一个点和一个多边形,求出这个多边形绕这个点旋转一圈后形成的面积.保证这个点不在多边形内. 画个图能明白 这个图形是一个圆环,那么就是这个 ...
- ARC下OC对象和CF对象之间的桥接(bridge)
在开发iOS应用程序时我们有时会用到Core Foundation对象简称CF,例如Core Graphics.Core Text,并且我们可能需要将CF对象和OC对象进行互相转化,我们知道,ARC环 ...
- [Recommendation System] 推荐系统之协同过滤(CF)算法详解和实现
1 集体智慧和协同过滤 1.1 什么是集体智慧(社会计算)? 集体智慧 (Collective Intelligence) 并不是 Web2.0 时代特有的,只是在 Web2.0 时代,大家在 Web ...
- CF memsql Start[c]UP 2.0 A
CF memsql Start[c]UP 2.0 A A. Golden System time limit per test 1 second memory limit per test 256 m ...
- CF memsql Start[c]UP 2.0 B
CF memsql Start[c]UP 2.0 B B. Distributed Join time limit per test 1 second memory limit per test 25 ...
- CF #376 (Div. 2) C. dfs
1.CF #376 (Div. 2) C. Socks dfs 2.题意:给袜子上色,使n天左右脚袜子都同样颜色. 3.总结:一开始用链表存图,一直TLE test 6 (1)如果需 ...
- CF #375 (Div. 2) D. bfs
1.CF #375 (Div. 2) D. Lakes in Berland 2.总结:麻烦的bfs,但其实很水.. 3.题意:n*m的陆地与水泽,水泽在边界表示连通海洋.最后要剩k个湖,总要填掉多 ...
- CF #374 (Div. 2) D. 贪心,优先队列或set
1.CF #374 (Div. 2) D. Maxim and Array 2.总结:按绝对值最小贪心下去即可 3.题意:对n个数进行+x或-x的k次操作,要使操作之后的n个数乘积最小. (1)优 ...
随机推荐
- kubernetes调度之pod优先级和资源抢占
系列目录 Pod可以拥有优先级.优先意味着相对于其它pod某个pod更为重要.如果重要的pod不能被调度,则kubernetes调度器会优先于(驱离)低优先级的pod来让处于pending状态的高优先 ...
- webstorm 设置IP 访问 手机测试效果
http://www.cnblogs.com/gulei/p/5126383.html 前端开发中,经常需要将做好的页面给其他同事预览或手机测试,之前一直用的第三方本地服务器usbwebserver, ...
- php中屏蔽date的错误
php中添加 date_default_timezone_set('asia/shanghai'); 可以屏蔽 <?php echo date('Y-m-d',$row3['time']); ...
- 解读SDN核心技术:OpenFlow深入分析(转载)
1 OpenFlow简介 OpenFlow是由斯坦福大学的Nick McKeown教授在2008年4月ACM Communications Review上发表的一篇论文OpenFlow: enabli ...
- EasyCamera海康摄像机向EasyDarwin云平台推送音视频数据的缓存设计
本文转自EasyDarwin团队成员Alex的博客:http://blog.csdn.net/cai6811376 EasyCamera在向EasyDarwin云平台推送音视频数据时,有时一个I帧会很 ...
- Boosting AdaBoosting Algorithm
http://math.mit.edu/~rothvoss/18.304.3PM/Presentations/1-Eric-Boosting304FinalRpdf.pdf Consider MIT ...
- The threads in the thread pool will process the requests on the connections concurrently.
https://docs.oracle.com/javase/tutorial/essential/concurrency/pools.html Most of the executor implem ...
- 解决express video 手机无法播放的问题
http://stackoverflow.com/questions/24976123/streaming-a-video-file-to-an-html5-video-player-with-nod ...
- NSString和NSMutableNSString的基本用法
// // main.m // NSString /** NSString 1.NSString 是一个不可以变的字符串对象 2.NSMutableString是一个可变字符串. 下面代码为字符串的: ...
- Non-parseable POM C:\Users\admin\.m2\repository\org\springframework问题解决方案
现象: [INFO] Scanning for projects... [ERROR] [ERROR] Some problems were encountered while processing ...