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 ...
随机推荐
- javascript一些有用但又不常用的特性
1.onclick="save();return false;" 取消“浏览器默认行为”. 比如一个链接 <a href="http://zhida ...
- MyBatis学习 之 一、MyBatis简介与配置MyBatis+Spring+MySql
目录(?)[-] 一MyBatis简介与配置MyBatisSpringMySql MyBatis简介 MyBatisSpringMySql简单配置 搭建Spring环境 建立MySql数据库 搭建My ...
- 编译boost (windows msvc14)
我的环境 OS: WIN10 (x64) IDE: VS2015 (VC14) http://www.boost.org/ 1. 下载 下载boost包, boost_1_62_0.7z 使用ASIO ...
- Linux 中直接 I/O 机制的介绍
https://www.ibm.com/developerworks/cn/linux/l-cn-directio/ 对于传统的操作系统来说,普通的 I/O 操作一般会被内核缓存,这种 I/O 被称作 ...
- mybatis Mapper XML 文件
MyBatis 的真正强大在于它的映射语句,也是它的魔力所在.由于它的异常强大,映射器的 XML 文件就显得相对简单.如果拿它跟具有相同功能的 JDBC 代码进行对比,你会立即发现省掉了将近 95% ...
- vc编译器 msvcr.dll、msvcp.dll的含义和相关错误的处理
转自:http://blog.csdn.net/sptoor/article/details/6203376 很久没有写程式设计入门知识的相关文章了,这篇文章要来谈谈程式库 (Library) 连结, ...
- STM32查看系统时钟
调用库函数RCC_GetClocksFreq,该函数可以返回片上的各种时钟的频率 函数原形 void RCC_GetClocksFreq(RCC_ClocksTypeDef* RCC_Clock ...
- C++实现网格水印之调试笔记(三)—— 初有结果
错误: error C2338: THE_BRACKET_OPERATOR_IS_ONLY_FOR_VECTORS__USE_THE_PARENTHESIS_OPERATOR_INSTEAD 这种错误 ...
- python中的类型转换
函数 描述 int(x [,base ]) 将x转换为一个整数 long(x [,base ]) 将x转换为一个长整数 float(x ) 将x转换到一个浮点数 complex(real [,imag ...
- Tkinter教程之Canvas篇(1)
本文转载自:http://blog.csdn.net/jcodeer/article/details/1811803 '''Tkinter教程之Canvas篇(1)'''# 提供可以用来进行绘图的Co ...