3273:【例45.2】 筷子大作战(C、C++、python)

3273:【例45.2】 筷子大作战

信息学奥赛一本通-编程启蒙(C++版)在线评测系统

[例 45.2]筷子大作战

信息学奥赛一本通-编程启蒙(C++版)在线评测系统




C代码:

/*
3273:【例45.2】 筷子大作战
http://bas.ssoier.cn:8086/problem_show.php?pid=3273
https://blog.csdn.net/wangchenchen1/article/details/104161609
*/
#include<stdlib.h>
#include<stdio.h>

int main()
{
	int n;
	int a,b;
	a=0;
	
	scanf("%d",&n);

	while(n--)
	{
		scanf("%d",&b);
		//cin>>b;
		a^=b;
	}
	printf("%d\n",a);
	//cout<<a<<endl;
	
	return 0;	
}



C++程序:

/*
3273:【例45.2】 筷子大作战
http://bas.ssoier.cn:8086/problem_show.php?pid=3273
https://blog.csdn.net/wangchenchen1/article/details/104161609
*/
#include<iostream>
#include<cstdio>
#include<stdio.h>
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
	int n;
	int a,b;
	a=0;
	cin>>n;
	while(n--){
		scanf("%d",&b);
		//cin>>b;
		a^=b;
	}
	printf("%d\n",a);
	//cout<<a<<endl;
	return 0;	
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
	ios::sync_with_stdio(0);
	int n,a=0,b;
	cin>>n;
	while(n--){
		cin>>b;
		a^=b;
	}
	cout<<a;
	return 0;
}


python3程序(66分)

n=int( input() )

m=0

for x in input().split():
    m^=int(x)

print(m)



 




《信息学奥赛一本通 编程启蒙C++版》3471-3475(5题)

《信息学奥赛一本通 编程启蒙C++版》3471-3475(5题)_3472:【例85.3】 过河问题-CSDN博客

《信息学奥赛一本通 编程启蒙C++版》3476-3480(5题)

《信息学奥赛一本通 编程启蒙C++版》3476-3480(5题)_3480:练86.1 旅行-CSDN博客

《信息学奥赛一本通 编程启蒙C++版》3481-3482(2题)

《信息学奥赛一本通 编程启蒙C++版》3481-3482(2题)_3481:练86.2 采药问题-CSDN博客

《信息学奥赛一本通 编程启蒙 C++版》 3471-3482(12题)

《信息学奥赛一本通 编程启蒙 C++版》 3471-3482(12题)_信奥一本通初赛版pdf-CSDN博客

《信息学奥赛一本通 编程启蒙C++版》3001-3482

《信息学奥赛一本通 编程启蒙C++版》3001-3482_信息学奥赛一本通第几版有答案3165--3185-CSDN博客

 

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

dllglvzhenfeng

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值