📄 2263915_tle.c
字号:
# include <stdio.h>
# include <string.h>
long p;
int pos[30002][2];
void input()
{
long i;
int x, y, num;
char com[2];
scanf("%ld",&p);
memset(pos,-1,sizeof(pos));
for(i = 0; i < p; i++)
{
scanf("%s",com);
if(com[0]=='M')
{
scanf("%d%d",&x,&y);
while(pos[x][0]!=-1)
x = pos[x][0];
while(pos[y][1]!=-1)
y = pos[y][1];
pos[x][0] = y;
pos[y][1] = x;
}
else
{
scanf("%d",&x);
num = 0;
while(pos[x][0]!=-1)
x = pos[x][0],num++;
printf("%d\n",num);
}
}
}
int main()
{
input();
return 1;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -