NAND
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)
Total Submission(s): 65 Accepted Submission(s): 14
bool f(bool x1, bool x2, bool x3){
//your code goes here
//return something
}
All possible inputs and expected outputs of this function have been revealed:
Xiaoqiang’s code must be like:
bool a = NAND(b, c);
where “a” is a newly defined variable,“b” and “c” can be a constant (0/1) or a function parameter (x1/x2/x3) or a previously defined variable. NAND is the “not-and” function:
NAND(b, c)=!(b&&c)
Because NAND is universal, Xiaoqiang knew that he could implement any boolean function he liked. Also, at the end of the code there should be a return statement:
return y;
where y can be a constant or a function parameter or a previously defined variable. After staring at the function for a while, Xiaoqiang came up with the answer:
bool a = NAND(x1, x2);
bool b = NAND(x2, x3);
bool y = NAND(a, b); return y;
Xiaoqiang wants to make sure that his solution is the shortest possible. Can you help him?
For each test case, there is one line containing 8 characters encoding the truth table of the function.
1
00010011
4
版权声明:本文博客原创文章,博客,未经同意,不得转载。
2014鞍山直播比赛H称号HDU5077(DFS修剪+通过计)的更多相关文章
-
ZOJ 3829 Known Notation (2014牡丹江H称号)
主题链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do? problemId=5383 Known Notation Time Limit: 2 S ...
-
2014牡丹江网络zoj3816Generalized Palindromic Number(dfs或者bfs)
#include <iostream> #include <stdio.h> #include <cmath> #include <algorithm> ...
-
H - Graphics(dfs)
H - Graphics Time Limit:1000MS Memory Limit:131072KB 64bit IO Format:%lld & %llu Submi ...
-
(比赛)B - 棋盘问题(dfs)
B - 棋盘问题 Time Limit:1000MS Memory Limit:10000KB 64bit IO Format:%lld & %llu Practice POJ ...
-
HDU 5071 Chat(2014鞍山B,模拟)
http://acm.hdu.edu.cn/showproblem.php?pid=5071 Chat Time Limit: 2000/1000 MS (Java/Others) Memory ...
-
CHD 2014迎新杯比赛题解
A. 草滩的魔法学校 分析: 高精度乘法 或 JAVA大数类 很明显 10000 的阶乘已经远远超过 64 位数能表示的范围了.所以我们要用一个比较大的数组来存放这个数.那数组要开多少位合适呢?我们不 ...
-
hdu 5073 Galaxy(2014 鞍山现场赛)
Galaxy Time Limit: 2000/1000 MS (J ...
-
hdu 5071(2014鞍山现场赛B题,大模拟)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5071 思路:模拟题,没啥可说的,移动的时候需要注意top的变化. #include <iostr ...
-
hdu5072 Coprime (2014鞍山区域赛C题)(数论)
http://acm.hdu.edu.cn/showproblem.php?pid=5072 题意:给出N个数,求有多少个三元组,满足三个数全部两两互质或全部两两不互质. 题解: http://dty ...
随机推荐
-
oracle 删除用户及相关表数据,释放磁盘空间
来源于:http://www.itpub.net/thread-513609-1-1.html http://bbs.csdn.net/topics/330251089 http://blog.csd ...
-
《C程序设计语言现代方法》第5章 选择语句
关系运算符的优先级低于算术运算符,关系运算符都是左结合的. 判等运算符的优先级低于关系运算符,判等运算符也是左结合的. 逻辑运算符将任何非零值操作数作为真值来处理,同时将任何零值操作数作为假值来处理. ...
-
MapReduce 表连接
题目描述: 根据给定的关系 child parent Tom Lucy Tom Jack Jone Lucy Jone Jack Lucy Mary Lucy Ben Jack Alice Jack ...
-
Java URL类踩坑指南
背景介绍 最近再做一个RSS阅读工具给自己用,其中一个环节是从服务器端获取一个包含了RSS源列表的json文件,再根据这个json文件下载.解析RSS内容.核心代码如下: class Presente ...
-
【ASP.NET Core】运行原理[3]:认证
本节将分析Authentication 源代码参考.NET Core 2.0.0 HttpAbstractions Security 目录 认证 AddAuthentication IAuthenti ...
-
01 整合IDEA+Maven+SSM框架的高并发的商品秒杀项目之业务分析与DAO层
作者:nnngu 项目源代码:https://github.com/nnngu/nguSeckill 这是一个整合IDEA+Maven+SSM框架的高并发的商品秒杀项目.我们将分为以下几篇文章来进行详 ...
-
Linux+DDoS deflate 预防DDoS攻击
使用DDoS脚本防止DDoS攻击 使用DDoS脚本防止DDoS攻击: DDoS概述: 分布式拒绝服务(DDoS:Distributed Denial of Service)攻击,指借助于客户/服务 ...
-
angular ng-repeat中DOM的重新渲染机制(项目中遇到问题)
昨天在项目中遇到一个问题:文本框中输入值只要变化就要请求接口获取数据赋值给couponData,这样性能不好.所以和服务器端沟通改成了服务器端一次性返回所有数据,这样前端只要获取一次数据然后保存在对象 ...
-
destoon手机端分页
$pages = ''; $pagesize = 2; $offset = ($page-1)*$pagesize; $rr = $db->get_one("SELECT COUNT( ...
-
Activity总结练习
package com.example.wang.myapplication; import android.content.Intent; import android.os.Bundle; imp ...