hdu 1259(模拟)

//模拟
#include <cstdio>
#include <iostream>

using namespace std;

void swap(char &a, char &b) {
char temp = a;
a = b;
b = temp;
}

int main() {
int t, i;
scanf ("%d", &t);
while (t--) {
int n, x, y;
char s[9] = {"#ZJUTACM"};
scanf ("%d", &n);
for (i=0; i<n; ++i) {
scanf ("%d%d", &x, &y);
if (s[x] == 'J' || s[y] == 'J') swap(s[x], s[y]);
}
for (i=1; i<8; ++i) {
if (s[i] == 'J') {
printf ("%d\n", i);
break;
}
}
}
return 0;
}

 

你可能感兴趣的:(HDU)