UVA 712 S-Trees
生活随笔
收集整理的這篇文章主要介紹了
UVA 712 S-Trees
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
二叉樹? 怒水~~
注意一下查詢與x值的對應關系就好~
?
?
1 #include <iostream> 2 #include <cstring> 3 #include <cstdio> 4 using namespace std; 5 6 int main (){ 7 char s[1000]; 8 int a[10],b[10]; 9 int n; 10 int m; 11 int kase=0; 12 while (~scanf ("%d",&n)&&n){ 13 char c[10]; 14 for (int i=0;i<n;i++){ 15 scanf ("%s",c); 16 a[i]=c[1]-'0';//cout<<a[i]<<"eee"; 17 } 18 scanf ("%s",s); 19 scanf ("%d",&m); 20 printf ("S-Tree #%d:\n",++kase); 21 for (int i=0;i<m;i++){ 22 scanf ("%s",c); 23 int temp=0; 24 for (int j=0;j<n;j++){ 25 b[j]=c[a[j]-1]-'0'; 26 temp=temp*2+b[j]; 27 } 28 printf ("%c",s[temp]);//cout<<temp<<"er"<<endl; 29 } 30 printf ("\n\n"); 31 } 32 return 0; 33 }轉載于:https://www.cnblogs.com/gfc-g/p/3860833.html
總結
以上是生活随笔為你收集整理的UVA 712 S-Trees的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: secureCRT 小技巧
- 下一篇: seajs打包部署工具spm的使用总结