网易雷火9.18笔试
3小时的题
我迟到了1个小时,提前了40分钟润,花了1个小时20分钟(中途有点其他事),a了2道,第三题没思路,第4题不想看,就这样吧

```cpp
#include <iostream>
using namespace std;
int main() {
int n;
cin>>n;
float sum=0;
for(int i=0;i<n;i++){
string str1,str2;
cin>>str1>>str2;
if(str1[0]==str2[0])sum+=2;
int m=str1.size();
int m2=str2.size();
int score1=0;
if(m==m2){
for(int i2=1;i2<m-5;i2++){
if(str1[i2]!=str2[i2])break;
if(i2==m-6)sum+=3;
}
}
int i1,j1;
for(int s=m-5;s<m;s++){
//i1=s;
for(int k=m2-5;k<m2;k++){
j1=k;
i1=s;
while(str1[i1]==str2[j1]){
i1++;
j1++;
if(i1>=m&&j1>=m2)break;//这一步至关重要
}
score1=max(score1,j1-k);
}
}
sum+=score1;
}
float score=((sum/10)/n)*100;
printf("%.2f",score);
cout<<"%"<<endl;
}
```

```cpp
#include <iostream>
#include<vector>
#include<queue>
using namespace std;
int main() {
int N,M;
cin>>N>>M;
vector<int>count(N);
vector<bool>screen(N);
vector<vector<int>>register1(N);
for(int i=0;i<N;i++){
int k;
cin>>k;
for(int j=0;j<k;j++){
int num;
cin>>num;
register1[i].push_back(num);
}
}
queue<int>Queue;
int MAXstop=0;
for(int i=0;i<M;i++){
for(int j=0;j<N;j++){
screen[j]=true;
}
int flag,number;
cin>>flag>>number;
if(flag==0)flag=-1;
Queue.push(number);
while(!Queue.empty()){
int sTop=Queue.front();
count[sTop]+=flag;
screen[sTop]=false;
Queue.pop();
for(int j=0;j<register1[sTop].size();j++){
if(screen[register1[sTop][j]]==false)continue;
Queue.push(register1[sTop][j]);
}
}
int mcount=0;
for(int ss=0;ss<N;ss++){
if(count[ss]>0)mcount++;
}
MAXstop=max(MAXstop,mcount);
}
cout<<MAXstop<<endl;
}
```
第三题:


第四题:




太长了吧。。。#网易雷火##网易雷火23秋招笔试怎么这么难#
我迟到了1个小时,提前了40分钟润,花了1个小时20分钟(中途有点其他事),a了2道,第三题没思路,第4题不想看,就这样吧

```cpp
#include <iostream>
using namespace std;
int main() {
int n;
cin>>n;
float sum=0;
for(int i=0;i<n;i++){
string str1,str2;
cin>>str1>>str2;
if(str1[0]==str2[0])sum+=2;
int m=str1.size();
int m2=str2.size();
int score1=0;
if(m==m2){
for(int i2=1;i2<m-5;i2++){
if(str1[i2]!=str2[i2])break;
if(i2==m-6)sum+=3;
}
}
int i1,j1;
for(int s=m-5;s<m;s++){
//i1=s;
for(int k=m2-5;k<m2;k++){
j1=k;
i1=s;
while(str1[i1]==str2[j1]){
i1++;
j1++;
if(i1>=m&&j1>=m2)break;//这一步至关重要
}
score1=max(score1,j1-k);
}
}
sum+=score1;
}
float score=((sum/10)/n)*100;
printf("%.2f",score);
cout<<"%"<<endl;
}
```

```cpp
#include <iostream>
#include<vector>
#include<queue>
using namespace std;
int main() {
int N,M;
cin>>N>>M;
vector<int>count(N);
vector<bool>screen(N);
vector<vector<int>>register1(N);
for(int i=0;i<N;i++){
int k;
cin>>k;
for(int j=0;j<k;j++){
int num;
cin>>num;
register1[i].push_back(num);
}
}
queue<int>Queue;
int MAXstop=0;
for(int i=0;i<M;i++){
for(int j=0;j<N;j++){
screen[j]=true;
}
int flag,number;
cin>>flag>>number;
if(flag==0)flag=-1;
Queue.push(number);
while(!Queue.empty()){
int sTop=Queue.front();
count[sTop]+=flag;
screen[sTop]=false;
Queue.pop();
for(int j=0;j<register1[sTop].size();j++){
if(screen[register1[sTop][j]]==false)continue;
Queue.push(register1[sTop][j]);
}
}
int mcount=0;
for(int ss=0;ss<N;ss++){
if(count[ss]>0)mcount++;
}
MAXstop=max(MAXstop,mcount);
}
cout<<MAXstop<<endl;
}
```
第三题:


第四题:




太长了吧。。。#网易雷火##网易雷火23秋招笔试怎么这么难#