3273:【例45.2】 筷子大作战
[例 45.2]筷子大作战
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++版》3476-3480(5题)
《信息学奥赛一本通 编程启蒙C++版》3481-3482(2题)
《信息学奥赛一本通 编程启蒙 C++版》 3471-3482(12题)
《信息学奥赛一本通 编程启蒙C++版》3001-3482
《信息学奥赛一本通 编程启蒙C++版》3001-3482_信息学奥赛一本通第几版有答案3165--3185-CSDN博客