当前位置:网站首页>[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 ;
}
边栏推荐
- Dell筆記本周期性閃屏故障
- [force buckle]41 Missing first positive number
- Openjudge noi 1.7 10: simple password
- 什么是时间
- Deep learning environment configuration jupyter notebook
- Slam d'attention: un slam visuel monoculaire appris de l'attention humaine
- mysql: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such
- from .cv2 import * ImportError: libGL.so.1: cannot open shared object file: No such file or direc
- Advantages and disadvantages of code cloning
- Link sharing of STM32 development materials
猜你喜欢

Zynq transplant ucosiii

. Bytecode structure of class file

"Exquisite store manager" youth entrepreneurship incubation camp - the first phase of Shunde market has been successfully completed!

详解OpenCV的矩阵规范化函数normalize()【范围化矩阵的范数或值范围(归一化处理)】,并附NORM_MINMAX情况下的示例代码

第五篇,STM32系统定时器和通用定时器编程

Periodic flash screen failure of Dell notebook
![[Niuke classic question 01] bit operation](/img/f7/e3a482c379ec9bbdb453a05e5e08cb.jpg)
[Niuke classic question 01] bit operation
![[user defined type] structure, union, enumeration](/img/a5/d6bcfb128ff6c64f9d18ac4c209210.jpg)
[user defined type] structure, union, enumeration

Deep learning environment configuration jupyter notebook
![[force buckle]41 Missing first positive number](/img/2e/6a0d3ea9264798f67be1ec1c81ca9e.jpg)
[force buckle]41 Missing first positive number
随机推荐
Attention SLAM:一種從人類注意中學習的視覺單目SLAM
Telerik UI 2022 R2 SP1 Retail-Not Crack
Activereportsjs 3.1 Chinese version | | | activereportsjs 3.1 English version
Data sharing of the 835 postgraduate entrance examination of software engineering in Hainan University in 23
Learn to use code to generate beautiful interface documents!!!
Mongodb client operation (mongorepository)
Make a simple graphical interface with Tkinter
OSPF configuration command of Huawei equipment
Attention SLAM:一种从人类注意中学习的视觉单目SLAM
from .cv2 import * ImportError: libGL.so.1: cannot open shared object file: No such file or direc
Slow database query optimization
「精致店主理人」青年创业孵化营·首期顺德场圆满结束!
Configuring the stub area of OSPF for Huawei devices
集合(泛型 & List & Set & 自定义排序)
Stm32f407 ------- DAC digital to analog conversion
Slam d'attention: un slam visuel monoculaire appris de l'attention humaine
Stm32f407 ------- SPI communication
什么是时间
String comparison in batch file - string comparison in batch file
第四篇,STM32中断控制编程