当前位置:网站首页>Educational Codeforces Round 22 B. The Golden Age
Educational Codeforces Round 22 B. The Golden Age
2022-07-07 05:34:00 【Don't eat toast】
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <math.h>
#include <bitset>
#include <algorithm>
using namespace std;
#define X first
#define Y second
#define eps 1e-2
#define gcd __gcd
#define pb push_back
#define PI acos(-1.0)
#define lowbit(x) (x)&(-x)
#define bug printf("!!!!!\n");
#define mem(x,y) memset(x,y,sizeof(x))
typedef long long LL;
typedef long double LD;
typedef pair<int,int> pii;
typedef unsigned long long uLL;
#define int long long
const int N = 1e5+2;
const int INF = 1<<30;
const int mod = 1e9+7;
int x,y,L,R;
std::vector<int> v;
map<int,int> mp;
void solve(){
scanf("%lld%lld%lld%lld",&x,&y,&L,&R);
for(int i=1;i<=R;i=i*x){
for(int j=1;j+i<=R;j=j*y){
if(i+j>=L&&i+j<=R&&mp.count(i+j)==0){
v.push_back(i+j);
mp[i+j]=1;
}
// cout<<i<<" "<<j<<" "<<(R-i)/j<<" "<<y<<endl;
if((R-i)/j<y) break;
}
if(R/i<x) break;
}
v.push_back(R+1);
sort(v.begin(),v.end());
int st=L-1,ans=0;
for(int i=0;i<v.size();i++){
if(ans<v[i]-st-1){
ans=v[i]-st-1;
}
st=v[i];
}
cout<<ans<<endl;
return;
}
int32_t main()
{
// freopen("in.txt","r",stdin);
// freopen("out.txt","w",stdout);
// ios::sync_with_stdio(false);
int t = 1;
//scanf("%d",&t);
while(t--){
// printf("Case %d: ",cas++);
solve();
}
return 0;
}
边栏推荐
- [JS component] date display.
- Creation and use of thread pool
- Preliminary practice of niuke.com (9)
- Design, configuration and points for attention of network specified source multicast (SSM) simulation using OPNET
- Under the trend of Micah, orebo and apple homekit, how does zhiting stand out?
- 什么是依赖注入(DI)
- 利用OPNET进行网络任意源组播(ASM)仿真的设计、配置及注意点
- Is the human body sensor easy to use? How to use it? Which do you buy between aqara green rice and Xiaomi
- Mysql database learning (7) -- a brief introduction to pymysql
- Leakage relay jelr-250fg
猜你喜欢
分布式事务解决方案之2PC
Life experience of an update statement
《4》 Form
Make web content editable
漏电继电器JOLX-GS62零序孔径Φ100
How digitalization affects workflow automation
论文阅读【Sensor-Augmented Egocentric-Video Captioning with Dynamic Modal Attention】
漏电继电器JD1-100
【js组件】date日期显示。
How Alibaba cloud's DPCA architecture works | popular science diagram
随机推荐
基于 hugging face 预训练模型的实体识别智能标注方案:生成doccano要求json格式
[Oracle] simple date and time formatting and sorting problem
Flink SQL 实现读写redis,并动态生成Hset key
【js组件】自定义select
Let f (x) = Σ x^n/n^2, prove that f (x) + F (1-x) + lnxln (1-x) = Σ 1/n^2
一条 update 语句的生命经历
实现网页内容可编辑
Scheduledexecutorservice timer
Addressable pre Download
How can project managers counter attack with NPDP certificates? Look here
数字化如何影响工作流程自动化
说一说MVCC多版本并发控制器?
DOM node object + time node comprehensive case
JVM (XX) -- performance monitoring and tuning (I) -- Overview
利用OPNET进行网络单播(一服务器多客户端)仿真的设计、配置及注意点
《5》 Table
English语法_名词 - 所有格
Lombok插件
Mysql database learning (8) -- MySQL content supplement
Disk monitoring related commands