生活随笔
收集整理的這篇文章主要介紹了
2020年华科计算机考研机试题答案(没弄懂题目的意思)
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
2020年華科研究生復(fù)試機(jī)試題,包含測(cè)試數(shù)據(jù)和題目,里面是文檔和要所報(bào)文件。供考研學(xué)子學(xué)習(xí)使用。此數(shù)據(jù)量有點(diǎn)大,涉及到鏈表,數(shù)據(jù)轉(zhuǎn)換,和容器。以下代碼都是我寫(xiě)的,歡迎交流。原題目和測(cè)試文檔鏈接地址是[https://download.csdn.net/download/qq_41476542/12415227]。供需要測(cè)試的人使用
在這里插入圖片描述
在這里插入代碼片
#include "stdafx.h"#include <iostream>
#include <fstream>
#include <string>
#include <limits.h>
#include <windows.h>
#include <VECTOR>
#include <list>
using namespace std
;struct points
{int xuhao
;int inumber
;int Ep
[200];vector
<int> vetoreverypoint
;
};
vector
<points
> vecP
;
vector
<int> vecPlastselect
;
typedef list
<int> intList
;
unsigned int iLinenumber
=0;
unsigned int iAllPoint
=0;int IAllpoint
[2000000][200];
int IAllnuber
[2000000];
int Itemp
=0;
void CharToInt(char *Intput
,unsigned int * OutPut
)
{sscanf((LPSTR
)(LPCTSTR
)Intput
,"%d",&OutPut
);
}
void selectjiHe( vector
<points
> vecP
)
{int selectstart
=0;int selectCharstart
=0;Itemp
=vecP
.size();int selectPoint
=1,sj
=0;while(true){Itemp
=vecP
[selectstart
].vetoreverypoint
[selectCharstart
];Itemp
=vecP
[selectPoint
].vetoreverypoint
[sj
];if (vecP
[selectstart
].vetoreverypoint
[selectCharstart
]!=vecP
[selectPoint
].vetoreverypoint
[sj
]){Itemp
=vecP
[selectPoint
].vetoreverypoint
.size();if (selectPoint
<iLinenumber
&&sj
==Itemp
){sj
=0;selectPoint
++;}else if (selectPoint
<iLinenumber
&&sj
<Itemp
){sj
++;}else if(selectPoint
>iLinenumber
){cout
<<"留下集合%d"<<selectPoint
<<endl
;}}else{Itemp
=vecP
[selectstart
].vetoreverypoint
.size();if (selectstart
<iLinenumber
&&selectCharstart
>=Itemp
){selectstart
++;}else if (selectstart
<iLinenumber
&&selectCharstart
<Itemp
){selectCharstart
++;}else if (selectstart
>iLinenumber
){break;}}}}
void tanxinselect(vector
<points
> vecP
)
{Itemp
=vecP
.size();points tempTaget
;intList _intList
;int ijiheveceornumber
=0;int IRecordBkPoint
=0;
for(int j
=0;j
<iAllPoint
;j
++){_intList
.push_back(j
);}for(int vj
=0;vj
<iAllPoint
;vj
++){vecPlastselect
.push_back(vj
);}int bkLargeTosmall
=0;int ivecp
=0;list
<int>::reverse_iterator Iter
;intList
::iterator iter_e
;int vetlarg
=vecPlastselect
.size();for (int n
=0;n
<Itemp
;n
++){int sizetrmp
=_intList
.size();if (sizetrmp
==0){bkLargeTosmall
=n
;break;}if (vecPlastselect
.size()==0){bkLargeTosmall
=n
;}cout
<<"留下的元素為"<<n
<<endl
;cout
<<"容器大小為"<<vecPlastselect
.size()<<endl
;if (vecPlastselect
.size()==0){bkLargeTosmall
=n
;break;}else{int iitemp
;int num
=vecP
[n
].inumber
;for (int mv
=0;mv
<num
;mv
++){sizetrmp
=_intList
.size();int jjt
=0;bkLargeTosmall
=n
;int ite
=0;
ite
=0;if (vecPlastselect
.size()==0){bkLargeTosmall
=n
;}iitemp
=vecP
[n
].vetoreverypoint
[mv
];for (int vpi
=0;vpi
<vecPlastselect
.size();vpi
++){if(iitemp
==vecPlastselect
[vpi
] ){ite
++;vecPlastselect
.erase(vecPlastselect
.begin()+vpi
);break;} }}}}int Iputpoint
;for(int bk
=0;bk
<bkLargeTosmall
;bk
++){Iputpoint
=vecP
[bk
].xuhao
;cout
<<"留下的元素為"<<Iputpoint
<<endl
;}
}int main()
{string str
;points vectorPoint
;ifstream
file("D:\\我的文檔\\WeChat Files\\xpj13098878561\\FileStorage\\File\\2020-05\\計(jì)算機(jī)專業(yè)實(shí)踐考核\\SetCoveringTestData\\test01.txt");int Itempshuzu
[200];int cnt
= 1;if (!file
.is_open()){cout
<< "文件打開(kāi)失敗!" << endl
;}string Lineone
="";char Ctemp
[1000];getline(file
, Lineone
);char ClineNumber
[10]={0};char AllPoint
[10]={0};int Onebk
=0;int j
=0;for ( j
=0;j
<50;j
++){if (Lineone
[j
]==' '){Onebk
=j
;break;}else{ClineNumber
[j
]=Lineone
[j
];}}Itemp
=0;for ( j
=Onebk
+1;j
<50;j
++){if (Lineone
[j
]=='\n'||Lineone
[j
]==' '||Lineone
[j
]=='\0'){break;}else{AllPoint
[Itemp
]=Lineone
[j
];Itemp
++;}}sscanf((LPSTR
)(LPCTSTR
)ClineNumber
,"%d",&iLinenumber
);sscanf((LPSTR
)(LPCTSTR
)AllPoint
,"%d",&iAllPoint
);string strTempnumber
="";int number
=0;int everyLinenumber
=0;int Linelength
=0;int acm
=10;
int IEPTP
=0;int tln
=0;int Icen
;int IGetPointNumber
=0;
int oneJihePoint
=0;int INumbertimes
=0;for(int ll
=1;ll
<iLinenumber
*3+1;ll
++){getline(file
, str
);if (ll
%2==0){Linelength
=sizeof(str
);memset(Ctemp
,0,1000);for(tln
=0;tln
<Linelength
;tln
++){Ctemp
[tln
]=str
[tln
];}sscanf((LPSTR
)(LPCTSTR
)Ctemp
,"%d",&everyLinenumber
);IAllnuber
[INumbertimes
]=everyLinenumber
;INumbertimes
++; }if (ll
%3==0){IEPTP
=0;Icen
=0;Linelength
=str
.length();memset(Ctemp
,0,1000);for(tln
=0;tln
<Linelength
;tln
++){if (str
[tln
]==' '){sscanf((LPSTR
)(LPCTSTR
)Ctemp
,"%d",&Itemp
);IAllpoint
[IGetPointNumber
][IEPTP
]=Itemp
; vectorPoint
.xuhao
=IGetPointNumber
;vectorPoint
.vetoreverypoint
.push_back(Itemp
);vectorPoint
.inumber
=everyLinenumber
;Icen
=0;IEPTP
++;}else{Ctemp
[Icen
]=str
[tln
];Icen
++;}}vecP
.push_back(vectorPoint
);}}tanxinselect(vecP
);system("pause");
}
總結(jié)
以上是生活随笔為你收集整理的2020年华科计算机考研机试题答案(没弄懂题目的意思)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。