/*
name: 梅西迭代算法的实现 【相关文章:Struts程序各文件之间的关系(2)】 【扩展阅读:协议开发 中移动CMPP2.0协议API】 copyright: 2003(c) 【扩展信息:如何实现Struts 数据库应用程序(1】 author: 徐岩柏 date: 31-10-03 16:09 description: 该问题是线性移位寄存器的综合问题提出的,给定一个n长的 二元序列,如何求出产生这一序列的级数最小的线性移位寄存 器,即最短的线性移位寄存器 */#include <iostream>
#include <cstdlib> #include <cstdio> #include <vector> #include <fstream> using namespace std;int main(int argc, char *argv[])
{ typedef vector<bool> myarray; file://定义自己的数据类 myarray a; file://状态数组 ,用来保存给定的m序列? vector<int>l; file://线性移位寄存器的级数数组 myarray temp; vector<myarray> f; file://为线性移位寄存器对应的多项式 int n =0; ifstream infile("input.txt"); file://从文件中读取数据 ofstream outfile("output.txt"); file://把结果写入文件中。 if(!infile) { cout << "aata file input.txt is not ready! please check it"<<endl; exit (-1); } string strtemp; infile>>strtemp; file://读入n // cout << strtemp <<endl; n = atoi(strtemp.c_str()); infile>>strtemp; file://读入序列 ... 下一页