然后就是各种RE……一怒之下就不用数组了——
Code:
#include <cmath>
#include <cstdio>
#include <string>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
int ball,n=3;
int a,b;
cin>>ball;
while(n--)
{
cin>>a>>b;
ball= a==ball?b:b==ball?a:ball;
}
cout<<ball;
/*
int n,ball[5];
scanf("%d",&n);
ball[n]=1;
for(int i=1;i<=3;i++)
{
int a,b;
scanf("%d%d",&a,&b);
if(ball[a]+ball[b]==0);
else
{
ball[a]=1-ball[a];
ball[b]=1-ball[b];
}
}
for(int j=1;j<=3;j++) if(ball[j]==1) printf("%I64d",(__int64)j);
*/
fclose(stdin);
fclose(stdout);
return 0;
}