Description
Now, service providers, who want to send data from node A to node B are curious, which company is able to provide the necessary connections. Help the providers by answering their queries.
Input
After the list of connections, each test case is completed by a list of queries. Each query consists of two numbers A, B. The list (and with it the test case) is terminated by A=B=0. Otherwise, 1<=A,B<=n, and they denote the start and the endpoint of the query. You may assume that no connection and no query contains identical start and end nodes.
Output
Sample Input
3 1 2 abc 2 3 ad 1 3 b 3 1 de 0 0 1 3 2 1 3 2 0 0 2 1 2 z 0 0 1 2 2 1 0 0 0
Sample Output
ab d - z -
//
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
char str[100];
int n;
int a[250][250];
int strToInt(char* str)
{
int len=strlen(str);
int cnt=0;
for(int i=0;i<len;i++)
{
cnt|=(1<<(str[i]-'a'));
}
return cnt;
}
int main()
{
while(scanf("%d",&n)==1&&n)
{
int x,y;
memset(a,0,sizeof(a));
while(scanf("%d%d",&x,&y)==2&&x)
{
scanf("%s",str);
a[x][y]=strToInt(str);
}
for(int k=1;k<=n;k++)
{
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++)
{
a[i][j]|=(a[i][k]&a[k][j]);
}
}
}
while(scanf("%d%d",&x,&y)==2&&x)
{
int flag=0;
for(int i=0;i<26;i++)
{
if(a[x][y]&(1<<i))
{
printf("%c",i+'a');
flag=1;
}
}
if(!flag) printf("-");printf("\n");
}printf("\n");
}
return 0;
}
本文深入探讨了AI音视频处理领域中的视频分割与语义识别技术,介绍了如何利用这些技术进行内容理解与智能分析。
521

被折叠的 条评论
为什么被折叠?



