题意

n<=105

题解

一个数是不是偶数就是看有没有二这个质因子。

所以我们先预处理每个数的阶乘的二这个质因子的数量

然后按公式判断就行了。

 #include<iostream>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<algorithm>
using namespace std;
int t,a,b,cnt[];
int main(){
scanf("%d",&t);
for(int i=;i<=;i++){
int j=i;cnt[i]=cnt[i-];
while(j%==&&j){
j/=;cnt[i]++;
}
}
while(t--){
scanf("%d%d",&a,&b);
if(cnt[b]+cnt[a-b]==cnt[a])printf("1\n");
else printf("0\n");
}
return ;
}

最新文章

  1. SQL指南-SELECT语句
  2. SQL笔记-第七章,表连接
  3. php 使用zendstudio 生成webservice文件 wsdl
  4. Ogre1.8地形和天空盒的建立(一块地形)
  5. AD7190学习笔记
  6. BZOJ 3223 文艺平衡树 [codevs3303翻转区间]
  7. 在MVVMLight框架的ViewModel中实现NavigationService
  8. ubuntu下tcpdump使用
  9. 【转】20个令人敬畏的jQuery插件
  10. STL容器总结
  11. [转]Publishing and Running ASP.NET Core Applications with IIS
  12. 第二章:在HTML中使用JavaScript
  13. Regular Expression Syntax
  14. Java实现发送邮件(可配置)忘记密码,发送邮件
  15. 基于YOLOv3和Qt5的车辆行人检测(C++版本)
  16. ext图片预览功能实现,前端代码
  17. 安卓网络访问(xUtils3)
  18. Linux 内核里的“智能指针”【转】
  19. Centos7限速和测速
  20. hdu2886 Lou 1 Zhuang 数学/快速幂

热门文章

  1. 5G商用时代来临!这些产业将发生变革
  2. io框架
  3. BZOJ2179: FFT快速傅立叶 FFT实现高精度乘法
  4. LD_DEBUG
  5. Codeforces Round #470 (rated, Div. 2, based on VK Cup 2018 Round 1)A. Protect Sheep
  6. Python字典嵌套
  7. Python破解Wifi密码思路
  8. js 如何判断浏览器是否禁用cookie
  9. like
  10. POJ 2888