#include<iostream>#include<cstring>#include<queue>#include<vector>#include<cmath>#include<iomanip>using namespace std;struct Node{ int exp; double coe;};vector<Node> vRes;//将两个多项式相加,最后的结果保存在v1中。//即将两个有序链表merge在一起。void addPols(vector<Node> &v1,vecto Read More
#include<iostream>#include<cstring>#include<queue>using namespace std;int main(){ char str[100]; int len,n1,n2; cin>>str; len = strlen(str); //先求出n1和n2 if( (len-1)%2 == 0 ) { n1 = (len-1)/2; n2 = 3; } else { n1 = (len-2)/2; n2 = 4; } wh... Read More
#include<iostream>#include<cstring>#include<queue>using namespace std;//已知二叉树的后序和中序遍历,得到层次遍历顺序。const int N = 30;struct Node{ Node* left; Node* right; int data;};int postOrder[N];int inOrder[N];//b1,e1表示后序的开始和结束位置;b2,e2表示中序的开始和结束位置。void createTree(int b1,int e1,int b2,int e2,Node* & Read More
#include<iostream>#include<cstring>using namespace std;const int N = 1000;const int INF = 100000000;//图的邻接矩阵int road[N][N];//标记某一节点是否被访问过bool isVisited[N];//记录每一节点的权值int team_num[N];int dis[N];//最短路径的数目int path_num =0;//最大的医疗队的数目int g_max_team_num = 0;void initData(){ int i,j; for(i=0; i Read More
#include<iostream>#include<cstring>using namespace std;const int N = 1000;const int INF = 100000000;//图的邻接矩阵int road[N][N];//标记某一节点是否被访问过bool isVisited[N];//记录每一节点的权值int team_num[N];int dis[N];//最短路径的数目int path_num =0;//最大的医疗队的数目int g_max_team_num = 0;void initData(){ int i,j; for(i=0; i Read More