题目传送门

 /*
暴力:这题真是醉了,直接暴力竟然就可以了!复杂度不会分析,不敢写暴力程序。。
枚举x,在不重复的情况下+ans,超过范围直接break
*/
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std; typedef long long ll;
const int MAXN = 1e7 + ;
const int INF = 0x3f3f3f3f;
bool vis[MAXN]; int main(void) //hihoCoder 1178 计数
{
// freopen ("B.in", "r", stdin); ll n, L, R;
while (scanf ("%lld", &n) == )
{
if (n == ) break;
scanf ("%lld%lld", &L, &R);
memset (vis, false, sizeof (vis)); int ans = ;
for (ll i=; i<=5e7; ++i)
{
ll tmp = i ^ (n * i);
if (tmp >= L && tmp <= R) {if (!vis[tmp]) {vis[tmp] = true; ans++;}}
} printf ("%d\n", ans);
} return ;
}

最新文章

  1. javax.servlet.http.HttpServlet was not found
  2. Android Application 对象介绍
  3. Objective-C 和 C++中指针的格式和.方法 和内存分配
  4. Visual Studio 2013 各版本注册码
  5. Linux基础--用户和组管理
  6. Spring框架:Spring容器具体解释
  7. (转)C# WinForm中 获得当前鼠标所在控件 或 将窗体中鼠标所在控件名显示在窗体标题上
  8. 道格拉斯—普克(Douglas一Peukcer)节点抽稀算法
  9. BZOJ 3402: [Usaco2009 Open]Hide and Seek 捉迷藏(最短路)
  10. MySQL下载安装、基本配置、问题处理
  11. PHPStudy+PHPStorm下配置隐藏项目入口文件
  12. Invalid property &#39;url&#39; of bean class [com.mchange.v2.c3p0.ComboPooledDataSource]
  13. 【STM32H7教程】第6章 STM32H7工程模板建立(IAR8)
  14. handsontable的基础应用
  15. [Swift]LeetCode926. 将字符串翻转到单调递增 | Flip String to Monotone Increasing
  16. Redis事物
  17. SpringMVC中请求路径参数使用正则表达式
  18. 7.mongo python 库 pymongo的安装
  19. kafuka资料学习
  20. Java设计模式之八 ----- 责任链模式和命令模式

热门文章

  1. 【转】c++内存管理学习纲要
  2. input 文本框禁止输入表情
  3. vue-cli3取掉eslint格式提示报错
  4. 程序运行中(BSS段、数据段、代码段、堆栈)
  5. PHP开发者实用的代码
  6. 开发:异常收集之 DB2建表相关问题
  7. 【拆分版】Docker-compose构建Zookeeper集群管理Kafka集群
  8. 如何离线分析Kafka海量业务消息?1分钟快速为您支招
  9. Matplotlib绘图基础
  10. ZOJ 3691 Flower(最大流+二分)