当前位置:网站首页>[Niuke] b-complete square
[Niuke] b-complete square
2022-07-07 01:05:00 【*DDL_ GzmBlog】
Preface
Use stl Two points , The best subscript is from 0 Let's start
t a g : tag : tag: Two points
mathematics
The question :
Ideas :
l ≤ x ≤ r l\le x \le r l≤x≤r
l ≤ x ≤ r \sqrt l \le \sqrt x \le \sqrt r l≤x≤r
Again because l , r ≤ 1 0 9 l,r\le10^9 l,r≤109 So we can preprocess out x \sqrt x x Array
Finally, determine the square interval by bisection , The size of the square interval is the answer
code :
int a[N];
int i;
void init(){
Fup(i,1,1e5)a[i] = i;
}
void solve(){
int l,r;cin>>l>>r;
int n = 1e5;
int L = lower_bound(a+1,a+1+n,sqrt(l)) - a;
int R = upper_bound(a+1,a+1+n,sqrt(r)) - a;
cout<<max(R-L,0)<<endl;
}
int main(){
init();
int t;cin>>t;while(t--)
solve();
return 0 ;
}
边栏推荐
- 集合(泛型 & List & Set & 自定义排序)
- Informatics Orsay Ibn YBT 1172: find the factorial of n within 10000 | 1.6 14: find the factorial of n within 10000
- Telerik UI 2022 R2 SP1 Retail-Not Crack
- Rainstorm effect in levels - ue5
- Chenglian premium products has completed the first step to enter the international capital market by taking shares in halber international
- Dell笔记本周期性闪屏故障
- ActiveReportsJS 3.1中文版|||ActiveReportsJS 3.1英文版
- Meet the level 3 requirements of ISO 2.0 with the level B construction standard of computer room | hybrid cloud infrastructure
- Provincial and urban level three coordinate boundary data CSV to JSON
- . Bytecode structure of class file
猜你喜欢
Deeply explore the compilation and pile insertion technology (IV. ASM exploration)
迈动互联中标北京人寿保险,助推客户提升品牌价值
Part IV: STM32 interrupt control programming
第五篇,STM32系统定时器和通用定时器编程
Attention SLAM:一種從人類注意中學習的視覺單目SLAM
Part VI, STM32 pulse width modulation (PWM) programming
pytorch之数据类型tensor
Part V: STM32 system timer and general timer programming
New feature of Oracle 19C: automatic DML redirection of ADG, enhanced read-write separation -- ADG_ REDIRECT_ DML
学习光线跟踪一样的自3D表征Ego3RT
随机推荐
There is an error in the paddehub application
Eventbus source code analysis
Dell笔记本周期性闪屏故障
gnet: 一个轻量级且高性能的 Go 网络框架 使用笔记
[user defined type] structure, union, enumeration
Dr selection of OSPF configuration for Huawei devices
第六篇,STM32脉冲宽度调制(PWM)编程
学习使用代码生成美观的接口文档!!!
深度学习框架TF安装
[software reverse - solve flag] memory acquisition, inverse transformation operation, linear transformation, constraint solving
Deep learning environment configuration jupyter notebook
集合(泛型 & List & Set & 自定义排序)
Dell筆記本周期性閃屏故障
[yolov5 6.0 | 6.1 deploy tensorrt to torch serve] environment construction | model transformation | engine model deployment (detailed packet file writing method)
Learn to use code to generate beautiful interface documents!!!
建立自己的网站(17)
[HFCTF2020]BabyUpload session解析引擎
Cause of handler memory leak
threejs图片变形放大全屏动画js特效
pyflink的安装和测试