JZOJ 5197. 【NOIP2017提高组模拟7.3】C
Description
Input
Output
Sample Input
3
Sample Output
1
Data Constraint
Solution
这题我的方法是打表找规律,可以发现答案可用枚举偶数和系数推出。
实际上也可以用下式推出答案:
Gcd(a,b)≤a−b≤a xor bGcd(a,b)\leq a-b\leq a\ xor\ b
Code
#include<cstdio>
using namespace std;
int n,ans;
int main()
{scanf("%d",&n);for(int i=3;i<=n;i+=2){int k=n/i;for(int j=1;j<=k;j++){int p=i*j;if((p^p-j)==j) ans++;}}printf("%d",ans);return 0;
}
JZOJ 5197. 【NOIP2017提高组模拟7.3】C相关推荐
- NOIP2017提高组模拟赛4 (总结)
NOIP2017提高组模拟赛4 (总结) 第一题 约数 设K是一个正整数,设X是K的约数,且X不等于1也不等于K. 加了X后,K的值就变大了,你可以重复上面的步骤.例如K= 4,我们可以用上面的规则产 ...
- JZOJ 5182. 【NOIP2017提高组模拟6.29】码灵鼠
Description 码零鼠是一只很喜欢mx数学的神犇,上面那个不是ta本人的样子.这天,ta在研究一个神奇的数列,这个数列是这样的: a0 = 1 an = ai + aj (n>=1, i ...
- JZOJ 4932. 【NOIP2017提高组模拟12.24】B
Description 现在你有 NN 个数,分别为 A1,A2,-,ANA1,A2,-,AN ,现在有M组询问需要你回答.每个询问将会给你一个L和R(L<=R)(L,保证 MaxAi−MinA ...
- JZOJ 5195. 【NOIP2017提高组模拟7.3】A
Description Input Output Sample Input 7 3 Sample Output 4 Data Constraint Solution 这是一道经典的DP问题了,也可以把 ...
- JZOJ 5186. 【NOIP2017提高组模拟6.30】tty's home
Description Input Output Sample Input input 1: 5 1 1 1 1 1 1 2 2 3 3 4 4 5 input 2: 5 0 1 0 1 0 1 2 ...
- JZOJ 5185. 【NOIP2017提高组模拟6.30】tty's sequence
Description Input Output Sample Input input 1: 6 3 1 1 1 0 0 0 input 2: 6 3 1 1 0 1 0 0 input 3: 6 3 ...
- JZOJ 5184. 【NOIP2017提高组模拟6.29】Gift
Description Input Output Solution 这题看上去有些 01背包,但是细节上却大有不同. 先将价格从小到大排序,由于剩余的钱什么也不能买, 所以当没购买的物品中价格最小的为 ...
- JZOJ 5183. 【NOIP2017提高组模拟6.29】小T的钢琴
Description Input Output Sample Input 9 3 A1 B2 C3 D4 E5 D4.0 C3.0 B2.0 A1.0[nya] 3 A1 A1.0 E5[qwert ...
- JZOJ 5177. 【NOIP2017提高组模拟6.28】TRAVEL
Description Input Output Sample Input 4 4 1 2 1 10 2 4 3 5 1 3 1 5 2 4 2 7 Sample Output 6 2 3 4 5 6 ...
最新文章
- drupal7获取当前路径别名
- 算法笔记之分支限界法
- 集团化后的挚文还有很多“新故事”可以讲
- 没有人会告诉您乘坐飞机时的几个事实 但是您一定要知道
- Android之提示Cannot call this method while RecyclerView is computing a layout or scrolling
- C++中 list与vector的区别
- 谷歌跟oracle_谁赢得了Google VS Oracle? 开发人员赢了。
- [前台]---js中方法的强制返回和java中方法的强制返回
- 阿里云 MaxCompute 2018-09 新功能发布
- bzoj1232[Usaco2008Nov]安慰奶牛cheer*
- [******] 堆排序
- 【报告分享】2019互联网大会大佬演讲实录 (附11个演讲文档下载链接)
- (转)MTK softkey流程 必看
- java中加载窗口的函数_Java函数调用 - playgame的个人页面 - OSCHINA - 中文开源技术交流社区...
- Tensorflow:操作执行原理
- 触摸屏学习:利用状态机编程
- 如何在vue项目中增加网页logo
- Coded UI Test(二)创建一个Coded UI Test
- 7-12 愿天下有情人都是失散多年的兄妹 (25分)
- tiny-emitter 源码解析
热门文章
- Linux服务器与windows本地之间的数据同步
- 使用diskpart命令修复U盘分区
- pragma comment的使用 pragma预处理指令详解
- 关于激励函数的一些思考
- 利用matlab对xml文件进行批量处理
- DW Question Answer Pro 1.3.4 DWQA问答系统插件
- [C++调试笔记]网格划分grid_pic.cpp
- axios 登录后设置header_axios如何利用promise无痛刷新token
- 3DSlicer15:Scripted Module
- Qt修炼手册9_Ui名字空间及setupUi()原理解读