Codeforces Gym 100610 Problem E. Explicit Formula 水题
Problem E. Explicit Formula
Time Limit: 1 Sec
Memory Limit: 256 MB
题目连接
http://codeforces.com/gym/100610
Description
Consider 10 Boolean variables x1, x2, x3, x4, x5, x6, x7, x8, x9, and x10. Consider all pairs and triplets of distinct variables among these ten. (There are 45 pairs and 120 triplets.) Count the number of pairs and triplets that contain at least one variable equal to 1. Set f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10) = 1 if this number is odd and f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10) = 0 if this number is even. Here’s an explicit formula that represents the function f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10) correctly: f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10) = (x1 ∨ x2)⊕(x1 ∨ x3)⊕(x1 ∨ x4)⊕(x1 ∨ x5)⊕(x1 ∨ x6)⊕(x1 ∨ x7)⊕ (x1 ∨ x8) ⊕ (x1 ∨ x9) ⊕ (x1 ∨ x10) ⊕ (x2 ∨ x3) ⊕ (x2 ∨ x4) ⊕ (x2 ∨ x5) ⊕ (x2 ∨ x6) ⊕ (x2 ∨ x7) ⊕ (x2 ∨ x8) ⊕ (x2 ∨ x9)⊕(x2 ∨ x10)⊕(x3 ∨ x4)⊕(x3 ∨ x5)⊕(x3 ∨ x6)⊕(x3 ∨ x7)⊕(x3 ∨ x8)⊕(x3 ∨ x9)⊕(x3 ∨ x10)⊕ (x4 ∨ x5) ⊕ (x4 ∨ x6) ⊕ (x4 ∨ x7) ⊕ (x4 ∨ x8) ⊕ (x4 ∨ x9) ⊕ (x4 ∨ x10) ⊕ (x5 ∨ x6) ⊕ (x5 ∨ x7) ⊕ (x5 ∨ x8) ⊕ (x5 ∨ x9)⊕(x5 ∨ x10)⊕(x6 ∨ x7)⊕(x6 ∨ x8)⊕(x6 ∨ x9)⊕(x6 ∨ x10)⊕(x7 ∨ x8)⊕(x7 ∨ x9)⊕(x7 ∨ x10)⊕ (x8 ∨ x9) ⊕ (x8 ∨ x10) ⊕ (x9 ∨ x10) ⊕ (x1 ∨ x2 ∨ x3) ⊕ (x1 ∨ x2 ∨ x4) ⊕ (x1 ∨ x2 ∨ x5) ⊕ (x1 ∨ x2 ∨ x6) ⊕ (x1 ∨ x2 ∨ x7) ⊕ (x1 ∨ x2 ∨ x8) ⊕ (x1 ∨ x2 ∨ x9) ⊕ (x1 ∨ x2 ∨ x10) ⊕ (x1 ∨ x3 ∨ x4) ⊕ (x1 ∨ x3 ∨ x5) ⊕ (x1 ∨ x3 ∨ x6) ⊕ (x1 ∨ x3 ∨ x7) ⊕ (x1 ∨ x3 ∨ x8) ⊕ (x1 ∨ x3 ∨ x9) ⊕ (x1 ∨ x3 ∨ x10) ⊕ (x1 ∨ x4 ∨ x5) ⊕ (x1 ∨ x4 ∨ x6) ⊕ (x1 ∨ x4 ∨ x7) ⊕ (x1 ∨ x4 ∨ x8) ⊕ (x1 ∨ x4 ∨ x9) ⊕ (x1 ∨ x4 ∨ x10) ⊕ (x1 ∨ x5 ∨ x6) ⊕ (x1 ∨ x5 ∨ x7) ⊕ (x1 ∨ x5 ∨ x8) ⊕ (x1 ∨ x5 ∨ x9) ⊕ (x1 ∨ x5 ∨ x10) ⊕ (x1 ∨ x6 ∨ x7) ⊕ (x1 ∨ x6 ∨ x8) ⊕ (x1 ∨ x6 ∨ x9) ⊕ (x1 ∨ x6 ∨ x10) ⊕ (x1 ∨ x7 ∨ x8) ⊕ (x1 ∨ x7 ∨ x9) ⊕ (x1 ∨ x7 ∨ x10) ⊕ (x1 ∨ x8 ∨ x9) ⊕ (x1 ∨ x8 ∨ x10) ⊕ (x1 ∨ x9 ∨ x10) ⊕ (x2 ∨ x3 ∨ x4) ⊕ (x2 ∨ x3 ∨ x5) ⊕ (x2 ∨ x3 ∨ x6) ⊕ (x2 ∨ x3 ∨ x7) ⊕ (x2 ∨ x3 ∨ x8) ⊕ (x2 ∨ x3 ∨ x9) ⊕ (x2 ∨ x3 ∨ x10) ⊕ (x2 ∨ x4 ∨ x5) ⊕ (x2 ∨ x4 ∨ x6) ⊕ (x2 ∨ x4 ∨ x7) ⊕ (x2 ∨ x4 ∨ x8) ⊕ (x2 ∨ x4 ∨ x9) ⊕ (x2 ∨ x4 ∨ x10) ⊕ (x2 ∨ x5 ∨ x6) ⊕ (x2 ∨ x5 ∨ x7) ⊕ (x2 ∨ x5 ∨ x8) ⊕ (x2 ∨ x5 ∨ x9) ⊕ (x2 ∨ x5 ∨ x10) ⊕ (x2 ∨ x6 ∨ x7) ⊕ (x2 ∨ x6 ∨ x8) ⊕ (x2 ∨ x6 ∨ x9) ⊕ (x2 ∨ x6 ∨ x10) ⊕ (x2 ∨ x7 ∨ x8) ⊕ (x2 ∨ x7 ∨ x9) ⊕ (x2 ∨ x7 ∨ x10) ⊕ (x2 ∨ x8 ∨ x9) ⊕ (x2 ∨ x8 ∨ x10) ⊕ (x2 ∨ x9 ∨ x10) ⊕ (x3 ∨ x4 ∨ x5) ⊕ (x3 ∨ x4 ∨ x6) ⊕ (x3 ∨ x4 ∨ x7) ⊕ (x3 ∨ x4 ∨ x8) ⊕ (x3 ∨ x4 ∨ x9) ⊕ (x3 ∨ x4 ∨ x10) ⊕ (x3 ∨ x5 ∨ x6) ⊕ (x3 ∨ x5 ∨ x7) ⊕ (x3 ∨ x5 ∨ x8) ⊕ (x3 ∨ x5 ∨ x9) ⊕ (x3 ∨ x5 ∨ x10) ⊕ (x3 ∨ x6 ∨ x7) ⊕ (x3 ∨ x6 ∨ x8) ⊕ (x3 ∨ x6 ∨ x9) ⊕ (x3 ∨ x6 ∨ x10) ⊕ (x3 ∨ x7 ∨ x8) ⊕ (x3 ∨ x7 ∨ x9) ⊕ (x3 ∨ x7 ∨ x10) ⊕ (x3 ∨ x8 ∨ x9) ⊕ (x3 ∨ x8 ∨ x10) ⊕ (x3 ∨ x9 ∨ x10) ⊕ (x4 ∨ x5 ∨ x6) ⊕ (x4 ∨ x5 ∨ x7) ⊕ (x4 ∨ x5 ∨ x8) ⊕ (x4 ∨ x5 ∨ x9) ⊕ (x4 ∨ x5 ∨ x10) ⊕ (x4 ∨ x6 ∨ x7) ⊕ (x4 ∨ x6 ∨ x8) ⊕ (x4 ∨ x6 ∨ x9) ⊕ (x4 ∨ x6 ∨ x10) ⊕ (x4 ∨ x7 ∨ x8) ⊕ (x4 ∨ x7 ∨ x9) ⊕ (x4 ∨ x7 ∨ x10) ⊕ (x4 ∨ x8 ∨ x9) ⊕ (x4 ∨ x8 ∨ x10) ⊕ (x4 ∨ x9 ∨ x10) ⊕ (x5 ∨ x6 ∨ x7) ⊕ (x5 ∨ x6 ∨ x8) ⊕ (x5 ∨ x6 ∨ x9) ⊕ (x5 ∨ x6 ∨ x10) ⊕ (x5 ∨ x7 ∨ x8) ⊕ (x5 ∨ x7 ∨ x9) ⊕ (x5 ∨ x7 ∨ x10) ⊕ (x5 ∨ x8 ∨ x9) ⊕ (x5 ∨ x8 ∨ x10) ⊕ (x5 ∨ x9 ∨ x10) ⊕ (x6 ∨ x7 ∨ x8) ⊕ (x6 ∨ x7 ∨ x9) ⊕ (x6 ∨ x7 ∨ x10) ⊕ (x6 ∨ x8 ∨ x9) ⊕ (x6 ∨ x8 ∨ x10) ⊕ (x6 ∨ x9 ∨ x10) ⊕ (x7 ∨ x8 ∨ x9) ⊕ (x7 ∨ x8 ∨ x10) ⊕ (x7 ∨ x9 ∨ x10) ⊕ (x8 ∨ x9 ∨ x10) In this formula ∨ stands for logical or, and ⊕ stands for exclusive or (xor). Remember that in C++ and Java these two binary operators are denoted as “||” and “^”. Given the values of x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, calculate the value of f(x1, x2, . . . , x10).
Input
The input file contains 10 numbers x1, x2, x3, x4, x5, x6, x7, x8, x9, and x10. Each of them is either 0 or 1.
Output
Output a single value — f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10).
Sample Input
1 0 0 1 0 0 1 0 0 1
Sample Output
0
HINT
题意
就求题目给的那个式子的答案是多少
题解:
ctrl+f 把符号替换一下就好了……
代码:
//qscqesze
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <bitset>
#include <vector>
#include <sstream>
#include <queue>
#include <typeinfo>
#include <fstream>
#include <map>
#include <stack>
typedef long long ll;
using namespace std;
//freopen("D.in","r",stdin);
//freopen("D.out","w",stdout);
#define sspeed ios_base::sync_with_stdio(0);cin.tie(0)
#define maxn 110000
#define mod 10007
#define eps 1e-9
#define pi 3.1415926
int Num;
//const int inf=0x7fffffff; //§ß§é§à§é¨f§³
const ll Inf=0x3f3f3f3f3f3f3f3fll;
inline ll read()
{
ll x=,f=;char ch=getchar();
while(ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while(ch>=''&&ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
}
//************************************************************************************* ll x1,x2,x3,x4,x5,x6,x7,x8,x9,x10;
int main()
{
freopen("explicit.in","r",stdin);
freopen("explicit.out","w",stdout);
cin>>x1>>x2>>x3>>x4>>x5>>x6>>x7>>x8>>x9>>x10; cout<<((x1 || x2)^(x1 || x3)^(x1 || x4)^(x1 || x5)^(x1 || x6)^(x1 || x7)^
(x1 || x8) ^ (x1 || x9) ^ (x1 || x10) ^ (x2 || x3) ^ (x2 || x4) ^ (x2 || x5) ^ (x2 || x6) ^ (x2 || x7) ^ (x2 || x8) ^
(x2 || x9)^(x2 || x10)^(x3 || x4)^(x3 || x5)^(x3 || x6)^(x3 || x7)^(x3 || x8)^(x3 || x9)^(x3 || x10)^
(x4 || x5) ^(x4 || x6) ^ (x4 || x7) ^ (x4 || x8) ^ (x4 || x9) ^ (x4 || x10) ^ (x5 || x6) ^ (x5 || x7) ^ (x5 || x8) ^
(x5 || x9)^(x5 || x10)^(x6 || x7)^(x6 || x8)^(x6 || x9)^(x6 || x10)^(x7 || x8)^(x7 || x9)^(x7 || x10)^
(x8 || x9) ^ (x8 || x10) ^(x9 || x10) ^ (x1 || x2 || x3) ^ (x1 || x2 || x4) ^ (x1 || x2 || x5) ^ (x1 || x2 || x6) ^
(x1 || x2 || x7) ^ (x1 || x2 || x8) ^ (x1 || x2 || x9) ^ (x1 || x2 || x10) ^ (x1 || x3 || x4) ^ (x1 || x3 || x5) ^
(x1 || x3 || x6) ^ (x1 || x3 || x7) ^ (x1 || x3 || x8) ^ (x1 || x3 || x9) ^ (x1 || x3 || x10) ^ (x1 || x4 || x5) ^
(x1 || x4 || x6) ^ (x1 || x4 || x7) ^ (x1 || x4 || x8) ^ (x1 || x4 || x9) ^ (x1 || x4 || x10) ^ (x1 || x5 || x6) ^
(x1 || x5 || x7) ^ (x1 || x5 || x8) ^ (x1 || x5 || x9) ^ (x1 || x5 || x10) ^ (x1 || x6 || x7) ^ (x1 || x6 || x8) ^
(x1 || x6 || x9) ^ (x1 || x6 || x10) ^ (x1 || x7 || x8) ^ (x1 || x7 || x9) ^ (x1 || x7 || x10) ^ (x1 || x8 || x9) ^
(x1 || x8 || x10) ^ (x1 || x9 || x10) ^ (x2 || x3 || x4) ^ (x2 || x3 || x5) ^ (x2 || x3 || x6) ^ (x2 || x3 || x7) ^
(x2 || x3 || x8) ^ (x2 || x3 || x9) ^ (x2 || x3 || x10) ^ (x2 || x4 || x5) ^ (x2 || x4 || x6) ^ (x2 || x4 || x7) ^
(x2 || x4 || x8) ^ (x2 || x4 || x9) ^ (x2 || x4 || x10) ^ (x2 || x5 || x6) ^ (x2 || x5 || x7) ^ (x2 || x5 || x8) ^
(x2 || x5 || x9) ^ (x2 || x5 || x10) ^ (x2 || x6 || x7) ^ (x2 || x6 || x8) ^ (x2 || x6 || x9) ^ (x2 || x6 || x10) ^
(x2 || x7 || x8) ^ (x2 || x7 || x9) ^ (x2 || x7 || x10) ^ (x2 || x8 || x9) ^ (x2 || x8 || x10) ^ (x2 || x9 || x10) ^
(x3 || x4 || x5) ^ (x3 || x4 || x6) ^ (x3 || x4 || x7) ^ (x3 || x4 || x8) ^ (x3 || x4 || x9) ^ (x3 || x4 || x10) ^
(x3 || x5 || x6) ^ (x3 || x5 || x7) ^ (x3 || x5 || x8) ^ (x3 || x5 || x9) ^ (x3 || x5 || x10) ^ (x3 || x6 || x7) ^
(x3 || x6 || x8) ^ (x3 || x6 || x9) ^ (x3 || x6 || x10) ^ (x3 || x7 || x8) ^ (x3 || x7 || x9) ^ (x3 || x7 || x10) ^
(x3 || x8 || x9) ^ (x3 || x8 || x10) ^ (x3 || x9 || x10) ^ (x4 || x5 || x6) ^ (x4 || x5 || x7) ^ (x4 || x5 || x8) ^
(x4 || x5 || x9) ^ (x4 || x5 || x10) ^ (x4 || x6 || x7) ^ (x4 || x6 || x8) ^ (x4 || x6 || x9) ^ (x4 || x6 || x10) ^
(x4 || x7 || x8) ^ (x4 || x7 || x9) ^ (x4 || x7 || x10) ^ (x4 || x8 || x9) ^ (x4 || x8 || x10) ^ (x4 || x9 || x10) ^
(x5 || x6 || x7) ^ (x5 || x6 || x8) ^ (x5 || x6 || x9) ^ (x5 || x6 || x10) ^ (x5 || x7 || x8) ^ (x5 || x7 || x9) ^
(x5 || x7 || x10) ^ (x5 || x8 || x9) ^ (x5 || x8 || x10) ^ (x5 || x9 || x10) ^ (x6 || x7 || x8) ^ (x6 || x7 || x9) ^
(x6 || x7 || x10) ^ (x6 || x8 || x9) ^ (x6 || x8 || x10) ^ (x6 || x9 || x10) ^ (x7 || x8 || x9) ^ (x7 || x8 || x10) ^
(x7 || x9 || x10) ^ (x8 || x9 || x10)) <<endl; }
Codeforces Gym 100610 Problem E. Explicit Formula 水题的更多相关文章
- Codeforces Gym 100610 Problem A. Alien Communication Masterclass 构造
Problem A. Alien Communication Masterclass Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codefo ...
- Codeforces Gym 100610 Problem K. Kitchen Robot 状压DP
Problem K. Kitchen Robot Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/10061 ...
- Codeforces Gym 100610 Problem H. Horrible Truth 瞎搞
Problem H. Horrible Truth Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/1006 ...
- codeforces Gym 100187L L. Ministry of Truth 水题
L. Ministry of Truth Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100187/p ...
- Codeforces Gym 100342H Problem H. Hard Test 构造题,卡迪杰斯特拉
Problem H. Hard TestTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100342/at ...
- Codeforces Gym 100523C C - Will It Stop? 水题
C - Will It Stop?Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/ ...
- Codeforces Round #185 (Div. 2) B. Archer 水题
B. Archer Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/312/problem/B D ...
- Gym 101873K - You Are Fired - [贪心水题]
题目链接:http://codeforces.com/gym/101873/problem/K 题意: 现在给出 $n(1 \le n \le 1e4)$ 个员工,最多可以裁员 $k$ 人,名字为 $ ...
- Educational Codeforces Round 14 A. Fashion in Berland 水题
A. Fashion in Berland 题目连接: http://www.codeforces.com/contest/691/problem/A Description According to ...
随机推荐
- (4) Spring中定时任务Quartz集群配置学习
原 来配置的Quartz是通过spring配置文件生效的,发现在非集群式的服务器上运行良好,但是将工程部署到水平集群服务器上去后改定时功能不能正常运 行,没有任何错误日志,于是从jar包.JDK版本. ...
- 两个android程序间的相互调用(apk互调)
通常我们用到的只是activity之间的互相跳转和调用,很少会用到apk级别的互相调用. 往往在一些应用上会用到,比如一个支付系统,可能会有很多的一系列的程序调用到:彩票系统.订票系统.团购网……全部 ...
- Mysql线程池优化笔记
Mysql线程池优化我是总结了一个站长的3篇文章了,这里我整理到一起来本文章就分为三个优化段了,下面一起来看看. Mysql线程池系列一(Thread pool FAQ) 首先介绍什么是mys ...
- android学习—— context 和 getApplicationContext()
一直看到好多应用里面,随手使用getApplicationContext(),不想说也不乐意说,今天转载一篇文章区分两者的区别: 在android中常常会遇到与context有关的内容 浅论一下con ...
- 动态生成图片 保存到OutputStream
#region 把图片Copy到输出流 //获得图片全路径 string path = context.Server.MapPath("~/img/158_003.jpg"); / ...
- Asp.net 将DataTable 或者DataSet 转换为Json 格式
Web 开发中,将从数据库中取到的数据直接转换为 Json 格式的数据,在前台通过Ajax 无刷新显示在界面上,下面提供将DataTable 或者DataSet 转换为Json 的方法 /// < ...
- ARM指令集----杂项指令
ARM指令集可以分为6类,即是跳转指令,数据处理指令,程序状态传输指令,Load.Store指令,协处理器指令和异常中断指令 跳转指令: 在ARM中有两种方式可以实现程序的跳转,一种是跳转指令,另一种 ...
- CATALOGUE 目录
1 语言基础 1.1 c/c++ [转]C/C++ 存储类型 作用域 连接类型 [转]C/C++内存划分 [转]C/C++除法实现方式及负数取模详解 [转]为什么C++编译器不能支持对模板的分离式编译 ...
- QT-【转】2D编程
Qt中提供了强大的2D绘图系统,可以使用相同的API在屏幕上和绘图·设备上进行绘制,主要基于QPainter.QPainterDevice和QPainterEngine这3个类. 1.QPainter ...
- CentOS 7 安装 PyCharm for python
下载链接:http://www.jetbrains.com/pycharm/ 如果只是为了开发python,这个免费版的应该已经够了. 今天讲的是怎么在CentOS7下面安装 pycharm: 下载完 ...