2014鞍山直播比赛H称号HDU5077(DFS修剪+通过计)
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 ...
随机推荐
- python获取的信息列表微信公共平台和用户头像
转载注明原文地址:http://blog.csdn.net/btyh17mxy/article/details/25207889 只写模拟登陆的方式获取微信从信息和头像库列表公共平台, - 相关后,功 ...
- NET5 Web应用程序
ASP.NET5 Web应用程序结构 本文参考ASP.NET5 官方文档 Understanding ASP.NET 5 Web Apps,加入了一些个人理解,理解不对的地方希望大家能指出,互相学习. ...
- 【Git使用具体解释】EGit使用具体解释
此系列文章写给那些打算使用Git或正在使用Git,但对Git还不是非常理解的程序员们,希望能帮助大家在学习和使用Git的过程中少走弯路,并以最少的时间和代价来熟悉Git,让Git可以辅助很多其它的开发 ...
- 不一样的味道--Html和Xml解析、格式、遍历
很多其它内容查看官网:http://www.tinygroup.org TinyXmlParser一切以简单.有用.高速为主. 演示样例1:Xml字符串解析 比方,我们要解析一段Xml字符串,简单例如 ...
- 【转】tomcat 访问软连接文件夹下的网页出现404错误,description The requested resource (/xxx.html) is not available.
在 tomcat/webapps/ROOT/ 下建立一个软连接文件ln -s /home/ubuntu/report report 再到report软连接目录里建立个 report.html通过浏 ...
- mouseover与mouseenter与mousemove差额mouseout与mouseleave差额
<1> HTML <html> <head> <title></title> </head> <body> < ...
- 16.怎样自学Struts2之Struts2异常处理[视频]
16.怎样自学Struts2之Struts2异常处理[视频] 之前写了一篇"打算做一个视频教程探讨怎样自学计算机相关的技术",优酷上传不了,仅仅好传到百度云上: http://pa ...
- Objective-C语法简记学习
開始学习iPhone开发了,尽管如今已经有了Swift,但我还是老老实实地学习Objective-C,鄙人入门的程序语言是C,后来学习了C#和Java,如今来学Objective-C,这篇仅仅是一些非 ...
- iostream与iostream.h乱弹琴
#include <iostream.h> 非标准输出流 #include <iostream> 标准输出流 见短eclipse关于使用android ndk时的简单代码 ...
- 这个夏天不AC(杭州电2037)
这个夏天不AC Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Su ...