SYSUCPC2017 1007 Tutu’s Array II
题目大意:有A个0和B个1,每次取两个出来进行{XNOR,NAND,NOR}操作生成一个新的0/1,直到只剩一个元素。问最后是否可能剩下一个0,是否可能剩下一个1。
XNOR 比较特殊 a XNOR b = a xor b xor 1,所以可以发现答案只跟B的奇偶性有关
NAND和NOR 找规律发现,当A和B很大的时候,答案肯定是0和1都可以,所以手动或者用程序算出A和B比较小的情况 (A+B>3的答案都是B)
当时最后做的这道题,,有点烧脑 被前面的题搞的有点疲惫 最后没做出来 其实难度不大
在离散数学中 我们学习过恒真式 和这个问题有些类似 就当回顾一下这些逻辑运算 在博弈论中也有应用。
SYSUCPC2017 1007 Tutu’s Array II的更多相关文章
- 【leetcode】Remove Duplicates from Sorted Array II
Remove Duplicates from Sorted Array II Follow up for "Remove Duplicates":What if duplicate ...
- 【leetcode】Search in Rotated Sorted Array II
Search in Rotated Sorted Array II Follow up for "Search in Rotated Sorted Array":What if d ...
- 50. Remove Duplicates from Sorted Array && Remove Duplicates from Sorted Array II && Remove Element
Remove Duplicates from Sorted Array Given a sorted array, remove the duplicates in place such that e ...
- 49. Search in Rotated Sorted Array && Search in Rotated Sorted Array II
Search in Rotated Sorted Array Suppose a sorted array is rotated at some pivot unknown to you before ...
- Java for LeetCode 154 Find Minimum in Rotated Sorted Array II
Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 migh ...
- [OJ] Find Minimum in Rotated Sorted Array II
LintCode 160. Find Minimum in Rotated Sorted Array II (Medium) LeetCode 154. Find Minimum in Rotated ...
- Remove Element,Remove Duplicates from Sorted Array,Remove Duplicates from Sorted Array II
以下三个问题的典型的两个指针处理数组的问题,一个指针用于遍历,一个指针用于指向当前处理到位置 一:Remove Element Given an array and a value, remove a ...
- LeetCode 81 Search in Rotated Sorted Array II [binary search] <c++>
LeetCode 81 Search in Rotated Sorted Array II [binary search] <c++> 给出排序好的一维有重复元素的数组,随机取一个位置断开 ...
- LeetCode 80 Remove Duplicates from Sorted Array II [Array/auto] <c++>
LeetCode 80 Remove Duplicates from Sorted Array II [Array/auto] <c++> 给出排序好的一维数组,如果一个元素重复出现的次数 ...
随机推荐
- Redis 压缩存储的配置
如题,redis是采用了ziplist 元素在不足一定数量时采用压缩存储 hash: zset: list: 如上图所示: ziplist-entries:最大元素数量(即存储了多少个元素) zipl ...
- socket scoketserver
import socket sk = socket.socket() # 创建了一个socket对象 # sk.setsockopt(socket.SOL_SOCKET,socket.SO_REUSE ...
- Unix网络编程 — 头文件解析
1.1. < sys/types.h > primitive system data types(包含很多类型重定义,如pid_t.int8_t等) 1.2. < sys/socke ...
- HDU 3664 (水地推)
http://acm.hdu.edu.cn/showproblem.php?pid=3664 题意:给出数字n,问n的所有的排列中满足Ai>i 数字恰好为 k的排列的个数. sl : dp dp ...
- msp430入门学习00
在TI官网上找到MSP430的程序例程.数据手册.使用指南等文件.以MSP430F169为例,步骤如下: 1)进入ti官网:http://www.ti.com.cn/ 或者http://www.ti. ...
- Linux下汇编语言学习笔记4 ---
这是17年暑假学习Linux汇编语言的笔记记录,参考书目为清华大学出版社 Jeff Duntemann著 梁晓辉译<汇编语言基于Linux环境>的书,喜欢看原版书的同学可以看<Ass ...
- Our Journey of Dalian Ends 乌鲁木齐网络赛 最小费用最大流
Life is a journey, and the road we travel has twists and turns, which sometimes lead us to unexpecte ...
- DELPHI IDFTP
FTP是一个标准协议,它是在计算机和网络之间交换文件的最简单的方法. FTP也是应用TCP/IP协议的应用协议标准.FTP通常于将作者的文件上传至服务器,或从服务器上下传文件的一种普遍的使用方式作为用 ...
- [bzoj2982]combination_卢卡斯
Combination bzoj-2982 题目大意:求$C_n^m/%10007$. 注释:$1\le n,m\le 2\cdot 10^9$. 想法:裸卢卡斯定理. 先处理出$mod$数之内的阶乘 ...
- 搬砖--杭电校赛(dfs)
搬砖 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)Total Submissi ...