[恢]hdu 1259

2011-12-17 06:39:22

地址:http://acm.hdu.edu.cn/showproblem.php?pid=1259

题意:中文。水题,直接模拟。

代码:

# include <stdio.h>


int main ()
{
int i, T, m, a, b, t ;
int tab[10] ;
scanf ("%d", &T) ;
while (T--)
{
scanf ("%d", &m) ;
for (i = 1 ; i<= 7 ; i++)
tab[i] = i ;
while (m--)
{
scanf ("%d%d", &a, &b) ;
t = tab[a], tab[a] = tab[b], tab[b] = t ;
}
for (i = 1 ; i <= 7 ; i++)
if (tab[i] == 2) printf ("%d\n", i) ;
}
return 0 ;
}



原文地址:https://www.cnblogs.com/lzsz1212/p/2315205.html