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++> 给出排序好的一维数组,如果一个元素重复出现的次数 ...
随机推荐
- JavaScript中整型数据使用
JavaScript中整型数据使用 制作人:全心全意 JavaScript的数字格式允许精确地表示-900719925474092(-253)和900719925474092(253)之间的所有整数, ...
- 关于微信小程序getUserInfo最新修改后,如何在原有项目的授权逻辑的调整
今天一大早调试小程序,结果出现这个...微信小程序也是醉了,这么大的改动,也没有通过开发者服务号通知一声 人在屋檐下不得不低头(改呗,那么如何以最小的代价更新呢,下面给我的解决方案) 原来我们在首次进 ...
- mysql-5.7.17-winx64免安装配置
一,下载mysql-5.7.17-winx64.zip 地址:https://dev.mysql.com/downloads/file/?id=467269 二,解压到自己的某个磁盘:data文件夹和 ...
- 【转】WEB前端调优
首先从一次完整的的请求说起:(以此为例get,www,baidu.com) 1,webbrower 发出request, 2,然后解析www.baidu.com为ip,找到ip的服务器, 3,服务器处 ...
- [luoguP1097] 统计数字(水)
传送门 这么水的题,也只有提高组第一题了吧 代码 #include <cstdio> #include <iostream> #include <algorithm> ...
- hdu 3038带权并查集
#include<stdio.h> #include<string.h> #define N 200100 struct node { int x,count; }pre[N ...
- PatentTips - Register file supporting transactional processing
BACKGROUND OF THE INVENTION With the rise of multi-core, multi-threaded data processing systems, a k ...
- 关于jquery stopPropagation()阻止冒泡事件
我们经常会遇到点击两个或者多个重叠的层事件的时候,往往点击最里的的一层会接连触发外面的点击事件.这时候就需要用到stopPropagation事件即阻止冒泡事件html代码如下<!DOCTYPE ...
- HDU 5640 King's Cake【模拟】
题意: 给定长方形,每次从中切去一个最大的正方形,问最终可以得到多少正方形. 分析: 过程类似求gcd,每次减去最小的边即可. 代码: #include <cstdio> #include ...
- FJNUOJ1158(莫比乌斯反演)
题目:给定n个数字a1...an.有m个询问,格式为L R X Y,意为求aL到aR之间与x的最大公因数为y的个数. 数据组数T<=20 1<=n,m<=1e5 1<=ai&l ...