当前位置:网站首页>[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 ;
}
边栏推荐
- Openjudge noi 1.7 10: simple password
- Eventbus source code analysis
- 【JVM调优实战100例】04——方法区调优实战(上)
- Leetcode(547)——省份数量
- 【批处理DOS-CMD命令-汇总和小结】-跳转、循环、条件命令(goto、errorlevel、if、for[读取、切分、提取字符串]、)cmd命令错误汇总,cmd错误
- Cause of handler memory leak
- equals()与hashCode()
- [batch dos-cmd command - summary and summary] - view or modify file attributes (attrib), view and modify file association types (Assoc, ftype)
- 用tkinter做一个简单图形界面
- Zabbix 5.0:通过LLD方式自动化监控阿里云RDS
猜你喜欢
省市区三级坐标边界数据csv转JSON
Equals() and hashcode()
pyflink的安装和测试
第五篇,STM32系统定时器和通用定时器编程
Anfulai embedded weekly report no. 272: 2022.06.27--2022.07.03
Part 7: STM32 serial communication programming
Dell笔记本周期性闪屏故障
[牛客] [NOIP2015]跳石头
[batch dos-cmd command - summary and summary] - string search, search, and filter commands (find, findstr), and the difference and discrimination between find and findstr
Distributed cache
随机推荐
Learn self 3D representation like ray tracing ego3rt
「精致店主理人」青年创业孵化营·首期顺德场圆满结束!
Stm32f407 ------- SPI communication
A brief history of deep learning (II)
Windows installation mysql8 (5 minutes)
Rainstorm effect in levels - ue5
Advantages and disadvantages of code cloning
深度学习简史(二)
[yolov5 6.0 | 6.1 deploy tensorrt to torch serve] environment construction | model transformation | engine model deployment (detailed packet file writing method)
随时随地查看远程试验数据与记录——IPEhub2与IPEmotion APP
from . cv2 import * ImportError: libGL. so. 1: cannot open shared object file: No such file or direc
迈动互联中标北京人寿保险,助推客户提升品牌价值
Provincial and urban level three coordinate boundary data CSV to JSON
In rails, when the resource creation operation fails and render: new is called, why must the URL be changed to the index URL of the resource?
Telerik UI 2022 R2 SP1 Retail-Not Crack
「笔记」折半搜索(Meet in the Middle)
STM32开发资料链接分享
Stm32f407 ------- DAC digital to analog conversion
集合(泛型 & List & Set & 自定义排序)
用tkinter做一个简单图形界面