当前位置:网站首页>[bzoj2393] cirno's perfect math classroom
[bzoj2393] cirno's perfect math classroom
2022-07-20 14:56:00 【LauJiYeoung】
~Cirno Found a kind of baka Count , How about this number ~ Contains only 2 and ⑨ Two numbers ~~
Now? Cirno Want to know ~ In an interval ~~ How many numbers can be baka Integer division ~
however Cirno Such a genius goblin disdains to count
Only rely on smart you
A weakened version of SCOI2010 Lucky Numbers
Or consider the rapid growth rate of value, so it's good to tolerate violence
#include<bits/stdc++.h>
using namespace std;
typedef int INT;
#define int long long
int L,R;
int Baka[3000];
int vis[3000];
int A[3000];
int cnt=0;
void DFS(int x,int sum){
if(sum>R)return;
if(sum)Baka[++cnt]=sum;
DFS(x+1,sum*10+2);
DFS(x+1,sum*10+9);
}
int ans=0;
int GCD(int x,int y){
while(y){
int tmp=y;
y=x%y;
x=tmp;
}
return x;
}
void Solve(int x,int sum,int flag){
if(sum<0||sum>R)return;
if(x==A[0]+1){
if(!sum)return;
ans=(ans+(R/sum-L/sum)*flag);
return;
}
int tmp;
if(!sum)tmp=A[x];
else tmp=sum/GCD(A[x],sum)*A[x];
Solve(x+1,tmp,flag*-1);
Solve(x+1,sum,flag);
}
bool cmp(int A,int B){
return A>B;
}
signed main(){
cin>>L>>R;
L--;
DFS(1,0);
sort(Baka+1,Baka+1+cnt);
for(int i=1;i<=cnt;++i){
if(!vis[i])A[++A[0]]=Baka[i];
for(int j=i+1;j<=cnt;++j){
if(Baka[j]%Baka[i]==0)vis[j]=1;
}
}
sort(A+1,A+1+A[0],cmp);
Solve(1,0,-1);
cout<<ans;
}
边栏推荐
- 103.(cesium篇)cesium蜂巢图(正方形)
- With arbitrary pricing, products difficult to distinguish between true and false, and platforms running away, will the digital Tibet market continue to be popular?
- Interpretation of CBC mode and ECB mode
- Silvaco二极管、三极管、CMOS的制备
- 请问下flinksql有类似ifnull的函数吗?
- [cloud native] event publishing and subscription in Nacos -- observer mode
- 小程序技术解决桌面应用敏捷迭代的一种思路
- MySQL -- enterprise point general MySQL data synchronization solution
- 云原生指南:什么是云原生基础架构
- 【历史上的今天】7 月 18 日:英特尔成立;万维网上传了第一张照片;eBay 分拆 PayPal
猜你喜欢
随机推荐
Import word document pictures kernel synchronization and mutual exclusion
C语言初识
云原生指南:什么是云原生基础架构
云原生、Intel Arch及云原生机密计算 3 大 SIG 在线分享!今天见 | 第 32-34 期
Difference Between Accuracy and Precision
bootloader的原理分析
【历史上的今天】7 月 17 日:软银收购 ARM;第一次电子邮件中断;维基媒体国际会议
浅析IM即时通讯开发中Bitmap到底占用多大内存?
mos管的输入输出特性曲线及gm/id仿真曲线(cadence IC617)
【云驻共创】华为云助力加速构建企业数据资产和数据治理生产线
自定义持久层框架MyORMFramework(一)—JDBC分析和解决思路
target文件夹里的资源无法被程序加载
First knowledge of C language
读写分离备机备份报错
【历史上的今天】7 月 19 日:IMAP 协议之父出生;Project Kotlin 公开亮相;CT 成像实现新突破
Eolink 和 JMeter 接口测试对比
Build a full stack web application framework in 1 hour, support secondary development, and update and expand at any time
Input and output characteristic curve and gm/id simulation curve of MOS tube (cadence ic617)
云原生核心技术之:Service Mesh 的实现—— Istio
[cloud native] event publishing and subscription in Nacos -- observer mode