#include <iostream>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <vector>
#include <stack>
#include <deque>
#include <queue>
#include <bitset>
#include <list>
#include <map>
#include <set>
#include <iterator>
#include <algorithm>
#include <functional>
#include <utility>
#include <sstream>
#include <climits>
#include <cassert>
#define MID(x,y) ( ( x + y ) >> 1 )
#define L(x) ( x << 1 )
#define R(x) ( x << 1 | 1 )
#define BUG puts("here!!!");
#define STOP system("pause");
using namespace std;
int lowbit(int x) {
return x & (-x);
}
int main() {
int n, x;
cin >> n;
for(int i = 0; i < n; i++) {
cin >> x;
cout << x - lowbit(x) + 1 << ' ' << x + lowbit(x) - 1 << endl;
}
return 0;
}
相关推荐
保姆级教程:手把手教你用RKISP TURN为RV1106生成和配置IQfile(附AIQ版本匹配避坑指南)
本文提供RV1106 ISP调试的完整指南,详细讲解如何使用RKISP TURN工具生成和配置IQfile,包括环境搭建、参数调试、设备树配置及常见问题解决方案。特别强调AIQ版本匹配的重要性,帮助开发者避免常见陷阱,提升图像信号处理效率。
POJ 2309 BST
1、min和max为奇数,否则min和max非叶子,还可以向下拓展 2、根据满二叉树的性质,x的左右子树的个数都为2的k次方减1个节点 3、根据二叉树搜索的性质,左子树编号的区间为[min,x-1],右子树的编号区间为[x+1,max] 由此得出min=x-(2^k-1),max=x+(2^k-1) lowbit的作用,计算x对应的二进制数中第一个1的位置k,返回权值2k。 这个函数的作用就是求出t这个数的二进制存储下,最高的非0bit所表示的大小。 即满足2^k<=t的最大的2^k,其中k为非负整数。
Coze工作流实战:Coze一键生成沉浸式历史故事视频
【coze工作流实战】一键生成火爆的沉浸式历史故事视频!短短3分钟,顶替你3天的工作量!
poj 2309 BST
DescriptionConsider an infinite full binary search tree (see the figure below), the numbers in the nodes are 1, 2, 3, .... In a subtree whos
TWR-K65F180M评估板:基于Cortex-M4的嵌入式原型开发实战指南
在嵌入式系统开发中,微控制器(MCU)是核心,而围绕其构建的硬件平台则是将想法转化为可工作原型的关键。Cortex-M4内核凭借其高效的流水线、DSP指令集和浮点单元,为实时控制与信号处理提供了强大的运算能力。其技术价值在于,能够在较低功耗下满足工业控制、物联网网关等场景对能效比的严苛要求。为了快速验证系统设计,开发者常使用成熟的评估板来规避底层硬件设计的风险,直接聚焦于应用开发。本文以恩智浦的TWR-K65F180M评估板为例,深入解析其基于**ARM Cortex-M4**内核的K65 MCU的硬件架构
stm32H743IIT6 cubemx HAL USB UVC摄像头基础
stm32性能已经很强了, 可以驱动ov5640摄像头, 所以可以把摄像头接在stm32上, 当作一个摄像头驱动器, 连接到电脑上 开发环境: stm32cubemx 6.0.1 单片机: 自己做的stm32h743iit6核心板,兼容正点原子 学习资料: 圈圈学USB 鱼鹰谈单片机 从零开始学习USBhttps://to-run-away.blog.youkuaiyun.com/article/details/85038393 整个项目是基于CDC串口上修改 1 stm32 USB 代码概览 ..
poj 2309 BST(水)
BST 点击打开题目链接 Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 8546 Accepted: 5185 Description Consider an infinite full binary search tree (see the figure
3个国产AI大模型实战:如何用DeepSeek+豆包+千问批量生成高质量测试用例(附完整代码)
本文详细介绍了如何利用DeepSeek、豆包和千问三大国产AI大模型批量生成高质量测试用例的实战方法。通过Python环境配置、多模型SDK安装和统一接口封装,实现高效测试用例生成,并结合结构化提示词设计和多模型结果对比分析,显著提升测试效率和覆盖率。
POJ 2309 BST(二叉搜索树)
思路:除以2,找到商
GitLab CI/CD .gitlab-ci.yml 关键词(十一):发布版本 release
本篇文章介绍使用GitLab CI/CD 发布一个版本,对外发布。并填写一些发布的信息。
Vins-Fusion 外参camera-imu 标定
Vins-Fusion是一种基于优化的多传感器状态估计器,一大特色是支持实时camera-imu外参校准(相机和IMU之间的旋转)。Vins-Fusion 外参camera-imu校准是利用两帧间计算相机位姿和imu预积分得到位姿,构建最小二乘问题,并通过SVD求解camera-imu外参旋转矩阵。
POJ2309 BST(C++_数论_树)
Description Consider an infinite full binary search tree (see the figure below), the numbers in the nodes are 1, 2, 3, … In a subtree whose root node is X, we can get the minimum number in this subtre...
UE5、CesiumForUnreal实现加载GeoJson绘制多面(MultiPolygon)功能(支持点选高亮)
UE5、CesiumForUnreal实现加载GeoJson实现多面(MultiPolygon)的绘制功能,并且支持点选高亮和属性查询。
hdu 3177 Crixalis's Equipment (greedy - 沙王搬家问题 很好。。)
题目大意:向一个容量为V的洞中搬物品 每件物品有一个停放体积 可一个移动体积 问能否放下这些物品 解题思路:对这些物品进行排序 按照顺序依次进入洞中 排序要尽可能使得所有的东西都能进入洞中 这是一个贪心的问题 停放体积 移动体积 第一件物品 a1 b1 第二件物品 a2 b2 假设这两件物品的移动体积都不大于洞的体积V 那么将单独比较两个物品的时候会发现 a1+b2为先
大中型超市收银系统(可直接运行)
光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开
Camera2Demo
在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作
两棵二叉排序树合并为一颗 -- 07年 数据结构最后一道 [专硕]@NEU
#include #include #include const int N = 105; struct Node { int value; struct Node* lchild; struct Node* rchild; }; typedef struct Node Node; Node* creat() { Node* root; int v; scanf("%d", &v
VC中sqlite的使用
在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示
做ACM常用的C++头文件!
#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include
精雕软件(JDpaint) 5.5 绿色版
精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版
hdu 3068 最长回文 (Manacher O(n) ) (扩展KMP和后缀数组也都可以做 O(nlogn))
/* Subject: Manacher Algorithm Author : a_clay Created Date : 2011-12-26 Sample : hdu 3068 */ #include #include #include #include #include #include #define Bug cout << "here\n";
poj 1458 dp [最长公共子序列 O(n*m)]
#include #include #include using namespace std; int dp[1001][1001]; char s1[1001]; char s2[1001]; int get_max(int a, int b) { return a > b ? a : b; } int main() { int len1, len2, i, j; while
2012 天津 1002 Number (出自 ftiasch,我还不懂)
#include #include #include #include #include using namespace std; long long mySqrt(long long n){ long long r = max((long long)sqrt(n) - 5, 0LL); while((r + 1) * (r + 1) <= n){ r+
poj 1330 LCA [ vector 模拟邻接表存图 DFS 找到每个节点的层]
#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include
istringstream的使用方法——ACM对输入数据的处理方法
对于有些题目的输入数据处理起来有时候要花一些心思。在这里介绍c++的istringstream类帮助大家处理这些数据 1.使用这个类要引入这个头文件 2.使用方法 对于这样一个字符串"123 123 145 ,zzz kk,k oo.jjj" 要想用istringstream来处理首先要声明一个这个类的对象 方法:istringstream iss("123 123 145 ,zzz k
n个小孩围城一圈数数,数到 2^k, 就退出圈子。07年 C 语言最后一道![专硕]@NEU
#include #include #include using namespace std; struct Node { int value; Node* next; }; int n; Node* creatList(Node* &head, int n) { Node* p = head; for(int i = 2; i <= n; i++) {
__int64 与long long 的区别
//为了和DSP兼容,TSint64和TUint64设置成TSint40和TUint40一样的数 //结果VC中还是认为是32位的,显然不合适 //typedef signed long int TSint64; //typedef unsigned long int TUint64; //ANSI C中规定long long才能表示64位 //参
筛选法 的实现及其历史意义
筛选法又称筛法,是求不超过自然数N(N>1)的所有质数的一种方法。 据说是古希腊的埃拉托斯特尼(Eratosthenes,约公元前274~194年)发明的,又称埃拉托斯特尼筛子。 具体做法是:先把N个自然数按次序排列起来。1不是质数,也不是合数,要划去。第二个数2是质数留下来,而把2后面所有能被2整除的数都划去。2后面第一个没划去的数是3,把3留下,再把3后面所有能被3
poj 1505 copying Books 动态规划 -- 后续处理要细心~
历经不足两天,接近两天,哥终于 A 了你! 题意 : 假设有M本书(编号为1,2,…,M),想将每本复制一份,M本书的页数可能不同(分别是a1,a2,…,aM)。 任务时将这M本书分给K 个抄写员(K≤M〉,每本书只能分配给一个抄写员进行复制,而每个抄写员所分配到的书必须是连续顺序的。 要求复制总时间最短, 该如何分配抄写。 用 DP 做的,DP 还
491



被折叠的 条评论
为什么被折叠?



