#include<iostream>
#include<memory.h>
#include<algorithm>
#include<cstdio>
#include<string>
using namespace std;
int lowbit(int x)
{
return x&-x;
}
int d[100001];
int c[100001];
int n, m;
int gs(int x)
{
int q = 0;
for (int y = x;y > 0;y -= lowbit(y))q += c[y];
return q;
}
void gengxin(int xiabiao, int zhi)
{
for (int q = xiabiao;q <= n;q += lowbit(q))
{
c[q] += zhi;
//if (c[q] < 0)c[q] = 0;
}
}
int main()
{
int T;
cin >> T;
int u = 0;
while (T--)
{
memset(c, 0, sizeof(c));
d[0] = 0;
string oo;
cin >> oo;
n = oo.size();
scanf("%d",&m);
printf("Case %d:\n", ++u);
char yy[10];
int qq, ww;
while (m--)
{
//getchar();
scanf("%s", yy);
if (yy[0] == 'I')
{
scanf("%d%d", &qq, &ww);
gengxin(qq, 1);
gengxin(ww+1, -1);
}
else
{
scanf("%d", &qq);
if (gs(qq) % 2 == 0)
{
printf("%c\n", oo[qq - 1]);
}
else
{
printf("%d\n", !(oo[qq - 1] - '0'));
}
}
}
}
return 0;
}
相关推荐
博通PEX89000 PCIe 5.0交换芯片:如何为AI集群构建高效GPU互联架构
本文深入解析了博通PEX89000 PCIe 5.0交换芯片如何为AI集群构建高效的GPU互联架构。该芯片通过提供高带宽、低延迟的PCIe 5.0交换能力,打破传统GPU通信的带宽瓶颈,并支持多主机共享、资源池化及软件定义拓扑,从而显著提升大规模AI训练与推理任务的效率与资源利用率。
LightOJ 1080 树状数组
题目链接 模板题 区间更新单点查询的树状数组 add(i, val); add(j+1, -val); 实现区间[i,j]增加val。 查询方式即前n项和 sum(n) #include <stdio.h> #include <iostream> #include <string.h> #include <stdlib.h> #include &l...
从零开始,手把手教你用RTL代码设计一个简单的8位CPU(附状态图与ALU设计)
本文详细介绍了如何从零开始设计一个简单的8位CPU,包括状态机设计、ALU实现与RTL编码实战。通过具体的指令集分析、状态图设计和Verilog代码示例,帮助读者深入理解CPU工作原理,并掌握RTL代码编写技巧。特别适合计算机系统学习者和硬件设计爱好者。
M - Sending Packets LightOJ - 1321(spfa + 期望)
改下spfa的模板,求出从0点到n-1点,的最大成功率,那么期望E = d[n-1] * 2 * k * s; 直接输出就行了 #include using namespace std; const int Max_N = 1010; const int INF = 0x3f3f3f3f; struct Edge { int v; double cost; Edge(int _v = 0
从IR Drop到EM分析:数字IC电源规划中那些没人明说的细节(以MTCMOS配置为例)
本文深入探讨数字IC后端设计中电源规划的关键细节,特别关注MTCMOS配置、电源网络电阻最小化和level shifter供电等实战技巧。通过分析IR Drop和EM问题,提供优化floorplan和powerplan的具体策略,帮助工程师避免常见陷阱,提升芯片设计的稳定性和可靠性。
Python3.11安装fairseq避坑指南:解决dataclasses兼容性问题(附详细代码修改)
本文详细解析了在Python 3.11环境下安装Fairseq时因dataclasses模块规则变更导致的安装失败问题。通过定位核心配置文件,将`default=SomeConfig()`修改为`default_factory=SomeConfig`,并调整依赖版本,提供了从源码修改到环境验证的完整解决方案,确保Fairseq顺利运行。
lightoj 1321 Sending Packets
lightoj 1321 概率题
PX4从放弃到精通(二十二):日志
文章目录前言一、下载日志二、ulog转CSV三、利用flightplot软件分析PX4的ulog日志1 windos安装2 ubuntu18.04安装四、使用PlotJuggler分析PX4日志五、设置日志记录条件六、添加自定义日志消息 前言 PX4 1.10以上固件 QGC 一、下载日志 将飞控链接地面站,在下图页面点击“刷新”,即可看到保存的日志(前提是要有TF卡) 选择需要下载的日志,点击右侧的“下载”,然后选择目录即可进行下载,如果想擦除所有的日志,可以点击右侧的“擦除全部” 二、ulog转CS
LightOJ - 1321 - Sending Packets (spfa+期望dp)
1321 - Sending Packets PDF (English) Statistics Forum Time Limit:2 second(s) Memory Limit:32 MB Alice and Bob are trying to communicate through the internet. Just assume that th...
自定义Usecase/Pipeline
Summary of Custom Usecase and Pipeline Configuration in SA8650 QCX Framework This article elaborates on the complete process of customizing a new Usecase and Pipeline based on the SA8650 QCX framework to meet OEM and Tier1 customization requirements, with
[QMT量化交易小白入门]-三十五、如何将聚宽策略信号转为QMT实盘交易
Flask是一个轻量级的Web应用框架,它提供了简单而灵活的方式来构建Web应用程序。在本案例中,将使用Flask来搭建一个本地服务,用于监听来自jq2qmt.py脚本的交易信号,并根据信号执行相应的下单操作。
LightOJ 1080 Binary Simulation (线段树&成段更新)
http://lightoj.com/volume_showproblem.php?problem=1080 模板。 /*0.484s,4312KB*/ #include #include #include using namespace std; #define lson l , m , rt << 1 #define rson m + 1 , r , rt << 1 | 1
基于YOLOv8的建筑材料分类系统:从数据集构建到UI界面实现
建筑材料分类数据集需要包含各种常见建筑材料的图像,并对每种材料进行标注。砖块(Brick)混凝土(Concrete)钢筋(Rebar)木材(Wood)瓷砖(Tile)玻璃(Glass)钢材(Steel)塑料(Plastic)石膏板(Drywall)绝缘材料(Insulation)如果没有找到合适的公开数据集,可以构建自己的数据集。使用智能手机或专业相机拍摄各种建筑材料的照片确保在不同光照条件、角度和背景下拍摄每类材料至少收集300-500张图像。
LightOJ 1080 Binary Simulation【树状数组区间更新】
题目:LightOJ 1080 Binary Simulation 这个题也很有意思。常规来说应该是用线段树做吧?不过我选的做法是树状数组。 一般树状数组都是单点更新,区间查询。但是这个区间更新,单点查询也可以。具体原理怎么回事我不太明白,所以先贴一下。 这个题是记录次数,翻转为偶数次的就不变,为奇数次的翻转。
lwip-2.0.3
lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。
TMS_WebGMaps_1.9.8.0_Full_Source
TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder
LightOJ 1080 Binary Simulation 线段树区间更新
题目:http://www.lightoj.com/volume_showproblem.php?problem=1080 题意:给定一个01串,有两种操作,第一种I l r,把区间[l,r]内的1变0,0变1,第二种 Q i询问位置i的数字 思路:明显的线段树区间更新题目,注意当一个位置被更新偶数次,其实保持不变,那么lazy标记可以用异或操作,还有对于每个位置上数字的更新,也可以用异或,更
霍尼韦尔SoftMaster使用说明
霍尼韦尔SoftMaster使用说明
LightOJ 1080
线段树练习 #include #include #include #include #include using namespace std; #define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i)) #define rel(i,n) for(int (i)=1;(i)<=(int)(n);++(i)) #define rer(i,l,u) for(i
Statistics and Machine Learning Toolbox
Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具
LightOJ 1080 Binary Simulation
线段树模板题,开始用scanf("%c")一直错。。。 #include #include #include const int MAX = 1e5 + 5; char arr[MAX]; int res[3 * MAX]; void update(int idx, int st, int ed, int q_st, int q_ed) { if (st == q_st && q_e
Lightoj1080 【线段树】
题意: 给你一个0/1的数组,然后给你n段区间,说这个区间里要反转一次,然后给你Q个询问,问你这个位置是什么; 思路: 我们线段树维护一下就好了额; 其实反转的话,还是算次数是不是,奇偶嘛; #include using namespace std; typedef long long LL; const int N=1e5+10; struct SegT{ int sum;
【Lightoj 1080 Binary Simulation + 树状数组】
Binary SimulationDescription Given a binary number, we are about to do some operations on the number. Two types of operations can be here.‘I i j’ which means invert the bit from i to j (inclusive)
lightoj 1080 - Binary Simulation(树状数组)
Given a binary number, we are about to do some operations on the number. Two types of operations can be here. 'I i j' which means invert the bit from i to j (inclusive) 'Q i' answer whether th
lightoj-1080-Binary Simulation【树状数组】
题目链接:点击打开链接 1080 - Binary Simulation PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: 64 MB Given a binary number, we are about to d
LightOJ 1080 - Binary Simulation (树状数组)
1080 - Binary Simulation PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: 64 MB Given a binary number, we are about to do some operatio
lightoj 1080 - Binary Simulation(区间更新,单点查询)
1080 - Binary Simulation PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: 64 MB Given a binary number, we are about to do some operatio
BNU12999【LightOJ 1080 - Binary Simulation】+【树状数组】
BNU12999【LightOJ 1080 - Binary Simulation】+【树状数组】http://www.lightoj.com/volume_showproblem.php?problem=1080 1080 - Binary Simulation PDF (English) Statistics Forum Tim
lightoj 1080 Binary Simulation (线段树区间更新)
lightoj 1080 Binary Simulation (线段树区间更新)
Lightoj1080硬币翻转次数(区段更新)
Given a binary number, we are about to do some operations on the number. Two types of operations can be here. 'I i j' which means invert the bit from i to j (inclusive) 'Q i' answer whether t
429



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



