【Codeforces 339】Xenia and Bit Operations
Codeforces 339 D
题意:给定\(2^n\)个数字,现在把它们进行如下操作:
- 相邻的两个数取\(or\)
- 相邻的两个数取\(xor\)
- 以此类推,直到剩下一个数。
问每次修改一个数字,最后得到的那个数是多少。
思路:线段树。
但是在\(pushup\)的过程中要看当前节点到底层的叶子距离有多长,
如果是奇数就\(or\),否则\(xor\)。
单点修改,查询根即可。
【Codeforces 339】Xenia and Bit Operations的更多相关文章
- [codeforces 339]D. Xenia and Bit Operations
[codeforces 339]D. Xenia and Bit Operations 试题描述 Xenia the beginner programmer has a sequence a, con ...
- 【Codeforces 339C】Xenia and Weights
[链接] 我是链接,点我呀:) [题意] 在天平上放砝码 你要在左边放一下然后到右边放一下 一直重复这样放m次 每次你放在其中一边都要让另外一边的重量比你少 你可以用1~10中的某些砝码 问你要怎样放 ...
- 【Codeforces 342A】Xenia and Divisors
[链接] 我是链接,点我呀:) [题意] [题解] 最后a,b,c只有以下3种情况 1,2,4 1,2,6 1,3,6 那么用cnt[8]统计每个数字出现的次数. 输出cnt[4]次1,2,4 (如果 ...
- codeforces 339 D.Xenia and Bit Operations(线段树)
这个题目属于线段树的点更新区间查询,而且查的是整个区间,其实不用写query()函数,只需要输出根节点保存的值就可以了. 题意: 输入n,m表示有2^n个数和m个更新,每次更新只把p位置的值改成b,然 ...
- 【codeforces 415D】Mashmokh and ACM(普通dp)
[codeforces 415D]Mashmokh and ACM 题意:美丽数列定义:对于数列中的每一个i都满足:arr[i+1]%arr[i]==0 输入n,k(1<=n,k<=200 ...
- [codeforces 339]C. Xenia and Weights
[codeforces 339]C. Xenia and Weights 试题描述 Xenia has a set of weights and pan scales. Each weight has ...
- 【35.37%】【codeforces 556C】Case of Matryoshkas
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
- 【52.49%】【codeforces 556A】Case of the Zeros and Ones
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...
- 【23.39%】【codeforces 558C】Amr and Chemistry
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...
随机推荐
- 2018-08-14 中文代码之Spring Boot实现简单REST服务
最终目标详见: 参考MSDN,试搞.NET类库标识符的翻译版 · Issue #54 · program-in-chinese/overview 此文仅为技术探索+原型搭建的第一小步. 源码库: 演示 ...
- 华为P20无线投屏到电脑 绝地求生投射电脑
如今出门在外,必不可少的就是手机,如果没有了手机,每个人都会感觉没有安全感,感觉和世界失去了联系,我们每天每个人都在使用手机,但是作为华为手机用户的你,了解华为P20无线投屏到电脑是怎么操作的吗? 使 ...
- Android面试题总结(不定期更新、附答案)
1.Activity的启动模式? activity一共有4种启动模式:standard.singleTop singleTask .singleInstance standard:(标准模式)默认的就 ...
- eclipse安装中java环境的搭建
转自博客园:amandaj 做了小小改动. 一.java 开发环境的搭建 这里主要说的是在windows 环境下怎么配置环境. 1.首先安装JDK java的sdk简称JDK ,去其官方网站下载最近 ...
- Java中数组定义的三种方式
方法一: 1.先声明 2.分配空间 3.赋值 public class arr{ public static void main(String[] args){ int[] arr; //先声明 ar ...
- MySQL 5.7忘记root密码如何修改?
一直以来,MySQL的应用和学习环境都是MySQL 5.6和之前的版本,也没有去关注新版本MySQL 5.7的变化和新特性.今天帮人处理忘记root密码的时时候,发现以前的方法不奏效了.具体情况如下所 ...
- MyBatis笔记----(2017年)最新的报错:Cannot find class [org.apache.commons.dbcp.BasicDataSource] for bean with name 'dataSource' defined in class path resource [com/ij34/mybatis/applicationContext.xml]; nested e
四月 05, 2017 4:56:11 下午 org.springframework.context.support.ClassPathXmlApplicationContext prepareRef ...
- C#-循环语句(六)
for循环 格式: for(表达式1;循环条件;表达式2) { 循环体; } 解释:先执行表达式1,再判断循环条件是否为真,如果为真则执行循环体,执行完成后再执行表达式2 再次判断循环条件,由此一直反 ...
- oracle数据库访问形式
1. sql plus访问, sqlplus.exe 2. sql developer访问,sqldeveloper.exe 3. pl/sql 自己下载 4. browse https://loca ...
- windbg调试子进程
windbg 调试子进程 学习过程中遇到了一个从前未调试过的情景:我正在调试的进程通过CreateProcessW创建了一个子进程,我需要去了解子进程中发生的行为. 那么怎么去调试呢?OD 就有点麻烦 ...