1105 S-Trees
来源:互联网 发布:打色子软件 编辑:程序博客网 时间:2024/05/17 09:08
用二进制模拟
#include<iostream>#include<string>#include<math.h>using namespace std;int main(){//freopen("in.txt","r",stdin);//freopen("out.txt","w",stdout);int n;int count=0;while(cin>>n && n){string s[8];string ch;int data[100];for(int i=0;i<n;i++){cin>>s[i];}cin>>ch;for(int j=0;j<(int)pow(2.0,n);j++){//ch[j]=cin.get();//ch[j]=getchar();data[j]=(int)ch[j]-48;//cout<<ch[j]<<"?"<<endl;//cout<<data[j]<<"!"<<endl;}int op;cin>>op;//string opch[100][100];int option[100][100];int result[100];for(int k=0;k<op;k++){int t = 0;string opch;cin>>opch;for(int m=0;m<n;m++){//opch[k][m]=cin.get();option[k][m]=(int)opch[m]-48;t+= (int)pow(2.0,n-1-m)*option[k][m];//cout<<t<<endl;}result[k]=data[t];}cout << "S-Tree #" << ++count << ":\n";for(int p=0;p<op;p++){cout << result[p];}cout << endl;cout << endl;}return 0;}
0 0
- 1105 S-Trees
- 【POJ 1105 S-Trees】
- POJ 1105 S-Trees (模拟)
- 百练 1105: S-Trees
- S-Trees
- poj 1105 S-Trees 数组模拟建树
- poj S-Trees 1105 (二叉树模拟)
- UVa 712 S-Trees
- poj1105 S-Trees
- 712 - S-Trees***
- UVa 712 - S-Trees
- Uva 712 S-Trees
- uva 712 - S-Trees
- uva 712 - S-Trees
- UVa 712 - S-Trees
- 712 - S-Trees
- UVA712 S-Trees
- uva_712-S-Trees
- android 广告自动循环播放(CircleViewPager)
- 6月份业余时间安排
- DIV+CSS clear both清除产生浮动
- ListView(2)SimpleAdapter与SimpleCursorAdapter详解
- C++成员函数的存储方式
- 1105 S-Trees
- 第16周阅读程序1(1)
- 1106 Transmitters
- java异常总结
- Libgdx之Table 表格排版
- 做程序猿的wife应该注意的一些事情
- 二次封装快捷实现Echarts可视化图表
- 安装部署OFBIZ
- MQTT基础——Part 1. 认识MQTT