20140616问题1:G12是第6种12阶群,还是不构成群?
20140616问题2:G16、X16是第15、16种16阶群,还是不构成群?
// gap.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <fstream>
#include <iostream>
#include <vector>
#include<algorithm>
using namespace std;
#include <Windows.h>
#pragma comment(lib,"user32.lib")
std::vector<string> split( const std::string& str, const std::string& delims, unsigned int maxSplits = 0)
{
std::vector<string> ret;
unsigned int numSplits = 0;
// Use STL methods
size_t start, pos;
start = 0;
do
{
pos = str.find_first_of(delims, start);
if (pos == start)
{
// Do nothing
start = pos + 1;
}
else if (pos == std::string::npos || (maxSplits && numSplits == maxSplits))
{
// Copy the rest of the std::string
ret.push_back( str.substr(start) );
break;
}
else
{
// Copy up to delimiter
ret.push_back( str.substr(start, pos - start) );
start = pos + 1;
}
// parse up to next real data
start = str.find_first_not_of(delims, start);
++numSplits;
} while (pos != std::string::npos);
return ret;
}
vector<char> lof(const char *fn)
{
vector<char> ret;
FILE *fp;
int i=0;
char ch=0;
if((fp=fopen(fn, "rb"))!=NULL)
{
fseek(fp, 0, SEEK_SET);
while (ch!= EOF)
{
i++;
ch = fgetc(fp);
ret.push_back(ch);
};
fclose(fp);
}
if(ret.size()>0 && ret[ret.size()-1]==EOF)
ret.pop_back();
return ret;
//return (i-1);
}
vector<char> CharArrToNormal(const vector<char>& vec)
{
vector<char> ret;
int n=vec.size();
for(int i=0;i<n;i++)
{
#if 0
if(vec[i]==32)
{
if(ret.size()>0 && ret[ret.size()-1]!=',' && ret[ret.size()-1]!=';')
ret.push_back(',');
}
else if(vec[i]==13||vec[i]==10)
{
if(ret.size()>0 && ret[ret.size()-1]!=',' && ret[ret.size()-1]!=';')
ret.push_back(';');
}
#else
if(vec[i]==32||vec[i]==13||vec[i]==10)
{
if(ret.size()>0 && ret[ret.size()-1]!=',')
ret.push_back(',');
}
#endif
else
{
ret.push_back(vec[i]);
}
}
return ret;
}
string CharArrToStr(const vector<char>& vec)
{
string str;
int n=vec.size();
for(int i=0;i<n;i++)
{
str.push_back(vec[i]);
}
return str;
}
vector<vector<int>> atoTable(const char* strMtx)
{
vector<vector<int>> vvMtx;
vector<int> iAll;
if(strMtx!=0)
{
vector<string> All=split(strMtx,",");
for(int i=0;i<All.size();i++)
{
int iElem=atoi(All[i].c_str());
iAll.push_back(iElem);
}
}
int n=iAll.size();
int n1=(int)sqrtf(n);
if(n1*n1==n)
{
for(int i=0;i<n1;i++)
{
vector<int> iRow;
for(int j=0;j<n1;j++)
{
int iElem=iAll[i*n1+j];
iRow.push_back(iElem);
}
vvMtx.push_back(iRow);
}
}
return vvMtx;
}
vector<int> IsLegalMtx(const vector<vector<int>> &mtx)
{
vector<int> ret(3);
int illegal=-1;
ret[1]=mtx.size();
if(ret[1]=