日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

POJ 2570

發布時間:2024/6/14 编程问答 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 POJ 2570 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

可以看成floyd,用bool變量標記公司

View Code 1 #include<cstdio> 2 #include<cstring> 3 #include<set> 4 using namespace std; 5 bool ss[300][300][30]; 6 void floyd(int n) 7 { 8 for(int k=1;k<=n;k++) 9 { 10 for(int i=1;i<=n;i++) 11 { 12 if(ss[i][k][26]) 13 { 14 for(int j=1;j<=n;j++) 15 { 16 for(int t=0;t<26;t++) 17 if(ss[i][k][t]&&ss[k][j][t]) 18 { 19 ss[i][j][26]=ss[i][j][t]=true; 20 } 21 } 22 } 23 } 24 } 25 } 26 int main() 27 { 28 int n; 29 while(scanf("%d",&n)&&n) 30 { 31 memset(ss,false,sizeof(ss)); 32 int a,b; 33 char s[30]; 34 while(scanf("%d%d",&a,&b)&&a&&b) 35 { 36 scanf("%s",s); 37 for(int i=0;s[i];i++) 38 ss[a][b][s[i]-'a']=true; 39 ss[a][b][26]=true; 40 } 41 floyd(n); 42 while(scanf("%d%d",&a,&b)&&a&&b) 43 { 44 if(!ss[a][b][26]) 45 { 46 printf("-\n"); 47 } 48 else 49 { 50 for(int i=0;i<26;i++) 51 if(ss[a][b][i]) 52 putchar(char(i+'a')); 53 printf("\n"); 54 } 55 } 56 printf("\n"); 57 } 58 return 0; 59 }

轉載于:https://www.cnblogs.com/tmeteorj/archive/2012/09/02/2667311.html

與50位技術專家面對面20年技術見證,附贈技術全景圖

總結

以上是生活随笔為你收集整理的POJ 2570的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。