Twisted Circuit

题目描述

输入格式

The input consists of four lines, each line containing a single digit 0 or 1.

输出格式

Output a single digit, 0 or 1.

题意翻译

读入四个整数 00 或者 11,作为如图所示的电路图的输入。请输出按照电路图运算后的结果。

感谢@PC_DOS 提供的翻译

输入输出样例

输入 #1复制

复制代码
0
1
1
0

输出 #1复制

复制代码
0
cpp 复制代码
#include <iostream>
using namespace std;
const int N = 1001;
int a[N][N];
long long n,ch[10001],sh[10001];
int main()
{
   	int ch[5];
   	for(int i=0;i<4;i++){
   		cin>>ch[i];	
	}
	cout<<(((ch[0]^ch[1])&(ch[2]|ch[3]))^((ch[1]&ch[2])|(ch[0]^ch[3])));
    return 0;
} 
相关推荐
RTC老炮19 小时前
webrtc降噪-PriorSignalModelEstimator类源码分析与算法原理
算法·webrtc
深思慎考19 小时前
微服务即时通讯系统(服务端)——用户子服务实现逻辑全解析(4)
linux·c++·微服务·云原生·架构·通讯系统·大学生项目
草莓火锅21 小时前
用c++使输入的数字各个位上数字反转得到一个新数
开发语言·c++·算法
j_xxx404_21 小时前
C++ STL:阅读list源码|list类模拟|优化构造|优化const迭代器|优化迭代器模板|附源码
开发语言·c++
散峰而望21 小时前
C/C++输入输出初级(一) (算法竞赛)
c语言·开发语言·c++·算法·github
摇滚侠21 小时前
StreamAPI,取出list中的name属性,返回一个新list
数据结构·list
Kuo-Teng21 小时前
LeetCode 160: Intersection of Two Linked Lists
java·算法·leetcode·职场和发展
fie888921 小时前
基于MATLAB的狼群算法实现
开发语言·算法·matlab
曾几何时`1 天前
C++——this指针
开发语言·c++
偷偷的卷1 天前
【算法笔记 11】贪心策略六
笔记·算法