#include <iostream>
#include <cstdio>
using namespace std;
int gcd(int a,int b)
{
int t;
if(a<b)
{
t=a;a=b;b=t;
}
while(t=a%b)
{
a=b;
b=t;
}
return b;
}
int main()
{
int a,b,x,y,n,c,d;
scanf("%d%d",&x,&y);
scanf("%d",&n);
int tmp=gcd(x,y);
bool flag;
int ans;
while(n--)
{
flag=false;
scanf("%d%d",&a,&b);
c=tmp/a;d=(tmp-1)/b+1;
if(b-a<d-c)
{
for(int i=b;i>=a;i--)
{
if(tmp%i==0)
{
ans=i;
flag=true;
break;
}
}
}
else
{
for(int i=d;i<=c;i++)
{
if(tmp%i==0)
{
ans=tmp/i;
flag=true;
break;
}
}
}
if(flag)
printf("%d\n",ans);
else
printf("-1\n");
}
}相关推荐
PyCharm配置WSL开发环境保姆级教程:从安装Conda到项目依赖一键搞定
本文提供PyCharm配置WSL开发环境的完整教程,涵盖从安装Conda到项目依赖管理的全流程。详细介绍了WSL2环境准备、Conda环境配置、PyCharm远程解释器设置等关键步骤,并包含实用技巧和常见问题解决方案,帮助开发者高效搭建Python开发环境。
挂机水题日记 Cf - 75C
链接:http://codeforces.com/problemset/problem/75/C 题意: 给你两个数a ,b(1e9范围内),q个查询区间 [ l, r],问你这些区间内能找到的 a 和 b 的公因子最大是多少。 思路: 水题,枚举 gcd 因子的时候开平方优化完就过了。 核心思路就是枚举 gcd (a, b) 的因子,用max维护一下,那么枚举的过程中,如果a,b 的...
SNAP计算哨兵二号的叶面积指数(LAI)
对于哨兵二号数据以及LANDSAT8数据,SNAP提供已经集成好的模块计算LAI。在Optical->Thematic Land Processing->Biopyhsical Processor目录下面。 对于经过Sen2Cor处理好的数据,需经过重采样才可进行计算。重采样工具在Raster->Geometric->Resampling。 如果选择Biopyhsical Processor S2_10m进行计算,需要将所有的波段都重采样为10米(哨兵二号的第二波段为10米,可据此波
CF75C Modified GCD
这题,貌似无从下手QAQ 但是很简单就可以想到二分吧,正好二分能过QAQ 自然就是先跑一个gcd~~(想必大家都会了)~~ 然后… 然后就是一个二分呀QAQ 上代码 #include<bits/stdc++.h> using namespace std; int A,B,N,number=0; int divisor[10000]; int gcd(int x,int y)//gcd ...
白炽灯寿命工程解析:从钨丝蒸发到电压控制的可靠性设计
白炽灯作为一种经典的电光源,其工作原理基于电流通过钨丝产生热辐射发光。在高温下,钨丝会持续蒸发导致灯丝逐渐变细、电阻增大,这是影响其寿命的核心物理机制。从工程角度看,白炽灯的可靠性设计涉及材料科学、热力学和电路设计的交叉,技术价值在于通过理解其失效原理,可以在成本与性能间取得最佳平衡。在实际应用中,电压波动、开关浪涌电流和机械振动是主要寿命杀手,尤其在工业控制、仪器仪表和特定照明场景中,合理的设计能大幅提升系统稳定性。本文深入探讨了钨蒸发、热应力等关键因素,并结合浪涌抑制和降压设计等实战技巧,为工程师提供了
实战|2026美团&大众点评餐饮数据抓取:Playwright/Selenium反爬全攻略
核心结论:2026年美团&大众点评的反爬核心是“多维度风控”,需组合使用“住宅IP+设备指纹伪装+真人行为模拟+动态验证处理”,Playwright是最优工具,Selenium仅作为补充。效率优化:单机爬取速度建议控制在“每小时500-800条”,避免高频请求触发风控;分布式爬取需确保每个节点使用独立住宅IP,且行为轨迹不一致。扩展方向集成WASM解密工具,破解2026年美团的Token加密;用AI识别动态点选验证,提升验证通过率;对接大数据平台,对抓取的餐饮数据进行可视化分析。
Modified GCD
http://codeforces.com/problemset/problem/75/CC. Modified GCDtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputWell, here is another math class task.
基于BERTopic模型的英文20新闻数据集主题聚类及可视化
BERTopic是基于深度学习的一种主题建模方法。BERT是一种用于NLP的预训练策略,它成功地利用了句子的深层语义信息。
CodeForces 75C Modified GCD (二分+数论)
题目链接:http://codeforces.com/problemset/problem/75/C #include<bits/stdc++.h> using namespace std; #define debug puts("YES"); #define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++) #define ll long...
UDPProbe UDP端口存活探测(发送特征包+响应分析)、UDP服务识别
qDebug() << "收到响应:" << ip.toString() << ":" << port << " 服务:" << serviceName << " 响应长度:" << response.size();qDebug() << "开始探测:" << targetIp << ":" << port << " 超时时间:" << timeout << "ms";qInfo() << "\n==================== UDP探测结果 ====================";
把 SAP BTP Destination 写进 MTA:一段 com.sap.application.content 配置背后的部署编排学
MTA内容模块解析:SAP BTP中的声明式部署机制 本文详细解析了mta.yaml中com.sap.application.content模块在SAP BTP云环境中的作用。该模块通过声明式配置实现内容投递,无需编译或部署代码。核心功能包括: Destination创建:通过content-target:true标识将配置投递到Destination服务 HTML5应用部署:将静态资源投递到HTML5 Application Repository 安全集成:配置XSUAA服务实现OAuth2用户令牌交换
Modified LCS
给两个等差数列的长度,起点和数列的增加值,求两个数列中有几个数相同
STM32G4 电机外设篇(三) TIM1 发波 和 ADC COMP DAC级联
STM32G4电机控制外设应用笔记摘要:本文详细介绍了TIM1高级定时器生成三对互补PWM波的配置方法(预分频器PSC=30000,重装载值ARR=10000),重点说明需断开电机连线避免干扰。通过STM32CubeMX配置TIM1通道4触发ADC采样,设置RCR分频参数,并给出Keil代码修改要点。第二部分探讨了TIM1、ADC、比较器和DAC的级联应用,包括电流采样触发时序(在PWM波峰值前采样)和过流保护机制。配置步骤包含DAC3作为比较器负输入端、设置Break触发封波保护,并附关键代码段实现外设联
CodeForces 75C Modified GCD 【二分+数论】
题目链接 先求出a和b的最大公约数,找出其所有的因数——sqrt(n)的复杂度,涨姿势了。 然后就是判断所有的因数有没有落在low,high区间里面了——二分即可(upper_bound) C++版本: #include #include #include #include #include #include using namespace std; typed
霍尼韦尔SoftMaster使用说明
霍尼韦尔SoftMaster使用说明
Outlook Express 6 (OE6) for Win7/Win8/Win10
英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。
codeforces 75C C. Modified GCD(二分)
题目链接:codeforces 75C题目大意:给出两个数,查询[l,r]内这两个数的gcd题目分析:对这两个数的cd进行打表,然后二分查找即可。AC代码:#include <iostream> #include <algorithm> #include <cstring> #include <cstdio> #include <vector>using namespace std;int a,b,
计算机控制技术及应用
《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。
CodeForces - 75C Modified GCD
CodeForces - 75C Modified GCD 题解: 先求出a,b的gcd,然后求出gcd的所有因子(数目不会超过10^5)并sort,然后二分查找或者upper_bound(). AC代码 #include <bits/stdc++.h> using namespace std; typedef long long LL; const int maxn = ...
SIMATIC S7-1200, S7-1500 PID 控制[手册]
SIMATIC S7-1200, S7-1500 PID 控制[手册]
CodeForces 75 C.Modified GCD
Well, here is another math class task. In mathematics, GCD is the greatest common divisor, and it’s an easy task to calculate the GCD between two positive integers. A common divisor for two positive n...
Modified GCD CodeForces - 75C【二分、预处理】
题目链接,很好的一道二分加预处理的题目。 题面: Well, here is another math class task. In mathematics, GCD is the greatest common divisor, and it's an easy task to calculate the GCD between two positive integers. A commo...
CF#320 Div.2 总结
比赛网址:cf#320 Div.2 晚上11点开始的比赛,持续2个半小时。结束时有两道题题过了预测数据,分时是A题和C题。 比赛开始的时候,理所当然地从A题开始看起。A题比较容易,稍微分析一下就可以看出是一道10进制转2进制的题目,虽然题目比较简单,但是由于敲代码不够熟练,并且还要测试一些数据的原因,当我提交时已经有接近2000人A了此题。 然后我开始看B题,B题题意比较容易理解,而且我觉得
cf 598A Tricky Sum
#include using namespace std; #define LL long long const LL MAXN=1000000000; LL a[30]={1}; LL b[30]={1}; int main() { for(int i=1;i<=30;i++) a[i]=2*a[i-1]; for(int i=1;i<30;i++)
cf 20a BerOS file system
#include #include using namespace std; int main() { string s; cin>>s; bool flag=false; int p=s.length()-1; while(s[p]=='/') p--; if(p==-1) s="/"; else
cf 88b Keyboard
#include #include #include using namespace std; #define del(a,b) memset(a,b,sizeof(a)) struct node { int x,y; }nn[900]; int aa[130]; bool flag; int n,m,x,q,ans,snum; char kb[33][33]; string s;
cf #327 Div.2 Problem B Rebranding
#include #include #include using namespace std; int n,m; char aa[30]={'a'}; char s[200005]; char *ss[200005]; char a,b; int main() { for(int i=1;i<26;i++) aa[i]=aa[i-1]+1; scanf("%d
cf#320 Div.2 Problem C A Problem about Polyline
#include #include #include using namespace std; double ans,a; int x,y; int main(){ scanf("%d%d",&x,&y); if(y==x){ printf("%.12lf\n",(double)x); } else if(x<y){ print
cf 2a Winner
#include #include #include using namespace std; string ss[1005]; int x[1005]; int main() { int N; string win; int maxn=0; cin>>N; map M; for(int i=0;i<N;i++) { c
cf 8a Train and Peter
#include #include #include using namespace std; int main() { string s,s1,s2; bool f1=false,f2=false; cin>>s>>s1>>s2; int a,b; a=s.find(s1); if(a!=std::string::npos) {
309



被折叠的 条评论
为什么被折叠?



