//Accepted    6628 KB    520 ms
 //I a b   把a到b区间的二进制位去反,转化成a到b区间的数全部加1
 //Q a     判断第a位的奇偶
 #include <cstdio>
 #include <cstring>
 #include <iostream>
 #include <queue>
 #include <cmath>
 #include <algorithm>
 using namespace std;
 /**
   * This is a documentation comment block
   * 如果有一天你坚持不下去了,就想想你为什么走到这儿!
   * @authr songt
   */
 ;
 struct node
 {
     int l,r;
     int add;
     int t;
 }f[imax_n*];
 string s;
 void build(int t,int l,int r)
 {
     f[t].l=l;
     f[t].r=r;
     f[t].add=;
     if (l==r)
     {
         f[t].t=s[l-]-';
         return ;
     }
     ;
     build(*t,l,mid);
     build(*t+,mid+,r);
     f[t].t=f[*t].t+f[*t+].t;
 }
 void update(int t,int l,int r,int c)
 {
     if (f[t].l==l && f[t].r==r)
     {
         f[t].add+=c;
         return ;
     }
     f[t].t+=(r-l+)*c;
     ;
     *t,l,r,c);
     else
     {
         *t+,l,r,c);
         else
         {
             update(*t,l,mid,c);
             update(*t+,mid+,r,c);
         }
     }
 }
 int query(int t,int l,int r)
 {
     if (f[t].l==l && f[t].r==r)
     {
         );
     }
     ;
     f[t].t+=(r-l+)*f[t].add;
     f[*t].add+=f[t].add;
     f[*t+].add+=f[t].add;
     f[t].add=;
     *t,l,r);
     else
     {
         *t+,l,r);
         else
         {
             *t,l,mid)+query(*t+,mid+,r);
         }
     }
 }
 ];
 int Q;
 int x,y;
 void slove()
 {
     int len=s.length();
     build(,,len);
     scanf("%d",&Q);
     while (Q--)
     {
         scanf("%s",sq);
         ]=='I')
         {
             scanf("%d%d",&x,&y);
             update(,x,y,);
         }
         else
         {
             scanf("%d",&x);
             ,x,x);
             printf();
         }
     }
 }
 int main()
 {
     int T;
     scanf("%d",&T);
     ;
     while (T--)
     {
         cin>>s;
         printf("Case %d:\n",++t);
         slove();
     }
     ;
 }

最新文章

  1. winform中dataGridView隔行显示不同的背景色,鼠标移动上显示不同颜色,离开后变回原色
  2. Git学习笔记(6)——Bug和Feature分支
  3. [No00002C]人的寿命应该能达到100至175岁-北大齐教授健康讲座笔录
  4. System.exit(0)和System.exit(1)区别
  5. 从输入url到页面加载完成都发生了什么?
  6. poj 1696 Space Ant (极角排序)
  7. Android沉浸式(侵入式)标题栏(状态栏)Status(三)
  8. [原]在Fedora 20环境下安装系统内核源代码
  9. URAL1355. Bald Spot Revisited
  10. 与IO相关的等待事件troubleshooting-系列5
  11. SD卡中FAT32文件格式高速入门(图文具体介绍)
  12. XML的序列化和反序列化 详细介绍
  13. Git的安装
  14. JavaScript———从setTimeout与setInterval到AJAX异步
  15. 裁剪Ubuntu内核和模块管理2
  16. 你必须知道的.net读书笔记之第二回深入浅出关键字---对抽象编程:接口和抽象类
  17. UNICODE与ASCII
  18. [转]Virtio balloon
  19. 菜鸟Vue学习笔记(二)
  20. 利用python制作在Linux服务器后台定时运行的任务-邮件提醒

热门文章

  1. @ResponseStatus
  2. JAVA_安装JDK和Eclipse
  3. Java 集合系列 13 WeakHashMap
  4. 获取txt文件指定行内容
  5. Python中T-SNE实现降维
  6. JavaScript之模块化编程
  7. Play framework 2.0 -应用程序全局设置(转)
  8. jquery.query.js 插件的用法
  9. LevelDb简单介绍和原理——本质:类似nedb,插入数据文件不断增长(快照),再通过删除老数据做更新
  10. ORACLE 日期比较