当前位置:网站首页>[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 ;
}
边栏推荐
- UI控件Telerik UI for WinForms新主题——VS2022启发式主题
- Activereportsjs 3.1 Chinese version | | | activereportsjs 3.1 English version
- Grc: personal information protection law, personal privacy, corporate risk compliance governance
- 重上吹麻滩——段芝堂创始人翟立冬游记
- [Niuke classic question 01] bit operation
- ZABBIX 5.0: automatically monitor Alibaba cloud RDS through LLD
- 省市区三级坐标边界数据csv转JSON
- 「笔记」折半搜索(Meet in the Middle)
- ActiveReportsJS 3.1中文版|||ActiveReportsJS 3.1英文版
- Attention SLAM:一種從人類注意中學習的視覺單目SLAM
猜你喜欢

深度学习之数据处理

Equals() and hashcode()

UI控件Telerik UI for WinForms新主题——VS2022启发式主题
![[yolov5 6.0 | 6.1 deploy tensorrt to torch serve] environment construction | model transformation | engine model deployment (detailed packet file writing method)](/img/1a/2b497a1baa04d84d28da715d097dfe.png)
[yolov5 6.0 | 6.1 deploy tensorrt to torch serve] environment construction | model transformation | engine model deployment (detailed packet file writing method)

Attention SLAM:一種從人類注意中學習的視覺單目SLAM

Attention SLAM:一种从人类注意中学习的视觉单目SLAM

【批處理DOS-CMD命令-匯總和小結】-字符串搜索、查找、篩選命令(find、findstr),Find和findstr的區別和辨析

界面控件DevExpress WinForms皮肤编辑器的这个补丁,你了解了吗?

学习使用代码生成美观的接口文档!!!

重上吹麻滩——段芝堂创始人翟立冬游记
随机推荐
Let's talk about 15 data source websites I often use
Slow database query optimization
Stm32f407 ------- SPI communication
Learn to use code to generate beautiful interface documents!!!
一行代码实现地址信息解析
threejs图片变形放大全屏动画js特效
How do novices get started and learn PostgreSQL?
Learn self 3D representation like ray tracing ego3rt
Part IV: STM32 interrupt control programming
新手如何入门学习PostgreSQL?
学习使用代码生成美观的接口文档!!!
ActiveReportsJS 3.1中文版|||ActiveReportsJS 3.1英文版
深入探索编译插桩技术(四、ASM 探秘)
Zynq transplant ucosiii
深度学习之数据处理
Advantages and disadvantages of code cloning
深度学习框架TF安装
Part V: STM32 system timer and general timer programming
Pytorch中torch和torchvision的安装
随时随地查看远程试验数据与记录——IPEhub2与IPEmotion APP