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 ...
随机推荐
- 构建安全的Xml Web Service系列之如何察看SoapMessage
原文:构建安全的Xml Web Service系列之如何察看SoapMessage 上一篇文章地址:构建安全的Xml Web Service系列一之初探使用Soap头 (5-22 12:53) ...
- 【cocos2d-js官方文档】二十五、Cocos2d-JS v3.0中的单例对象
为何将单例模式移除 在Cocos2d-JS v3.0之前.全部API差点儿都是从Cocos2d-x中移植过来的,这是Cocos2d生态圈统一性的重要一环.可惜的是,这样的统一性也在非常大程度上限制了C ...
- POJ 3009-Curling 2.0(DFS)
Curling 2.0 Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 12158 Accepted: 5125 Desc ...
- 介绍4种HTML5 Canvas库
1.bHive.js Library http://www.bhivecanvas.com/ bHive能创建丰富的用户体验.动画.游戏,能够使开发更简单. demo: http://www.bhiv ...
- Visual Studio Team Services使用教程--Readers tfs组checkin权限修改
你也可以只开启部分代码的权限 把上面开启的整个应用的权限先去掉 只开启一个文件的权限
- 【三】注入框架RoboGuice使用:(Your First Resource Injection)
上一篇我们简单的介绍了一下RoboGuice的使用([二]注入框架RoboGuice使用:(Your First View Injection)),今天我们来看下资源文件的使用注解的方法: 为了在Ac ...
- sqlserver不能直接create table as select
sqlserver不能直接create table as select 在sqlserver 下想复制一张表的,想到oracle下直接create table xxx as select * from ...
- ashx一般处理程序和HttpHandler
asp.net项目中,使用.ashx的文件(一般处理程序)可以用于处理客户端发送来的请求,并将服务器端的处理结果返回给客户端.它能返回的类型可以是文本.或者图片.有时候,我们可以在项目中使用.cs的文 ...
- 编写爬虫程序的神器 - Groovy + Jsoup + Sublime(转)
写过很多个爬虫小程序了,之前几次主要用C# + Html Agility Pack来完成工作.由于.NET FCL只提供了"底层"的HttpWebRequest和"中层& ...
- Centos使用dd命令制作U盘启动盘 wodim刻录光盘
首先格式化U盘:使用fdisk -l 查看U盘到挂载点,如我的为/dev/sdb1.卸载U盘,运行格式化命令:mkfs.vfat /dev/sdb1 然后又一次挂载U盘,開始制作启动盘: # dd ...