# 2024.6.20 网易互娱笔试 （已 ak ）

```#include<bits/stdc++.h>
using namespace std;
int n = 5;
int a[6],b[6],aa[6],bb[6];
int main()
{
for(int i = 1;i<=5;i++)cin>>a[i];
for(int i = 1;i<=5;i++)cin>>aa[i];
for(int i = 1;i<=5;i++)cin>>b[i];
for(int i = 1;i<=5;i++)cin>>bb[i];
bool flag = true;
int cnt1 = 1, cnt2 = 1;
while(cnt1 <=5 && cnt2 <=5)
{
//轮到小易
if(flag)
{
bb[cnt2]-=a[cnt1];
flag = false;
if(bb[cnt2]<=0)cnt2++;
}
else
{
aa[cnt1]-=b[cnt2];
flag = true;
if(aa[cnt1]<=0)cnt1++;
}
}
if(cnt1 <=5)
{
cout << "win"<<endl;
cout << n - cnt1 + 1 <<endl;
}
else
{
cout << "lose"<<endl;
cout << n - cnt2 + 1 <<endl;
}
}
```

```#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N = 410;
int n;
struct jianzhu
{
int val;
int a;
int b;
int c;
}p[N];
int sum = 0;
void dfs(int val, int aa,int bb,int cc,int start)
{
if(start>n)
{
return;
}
for(int i = start; i <=n;i++)
{
if(aa>=p[i].a && bb>=p[i].b && cc>=p[i].c)
{
sum = max(sum,val + p[i].val);
dfs(val + p[i].val,  aa - p[i].a,bb-p[i].b,cc-p[i].c,i + 1);
}
}
}
signed main()
{
int A,B,C;
cin>>n>>A>>B>>C;
for(int i = 1;i<=n;i++)
{
int a,b,c,v;
cin>>a>>b>>c>>v;
p[i]={v,a,b,c};
}
dfs(0,A,B,C,1);
cout << sum <<endl;
return 0;
}
```

```#include<bits/stdc++.h>
using namespace std;
const int N = 100010;
int n,q;
int b[5000][5000];
struct Dian
{
int x,y,r;
}dian[N];
void add(int x1,int y1,int x2,int y2,int c)
{
b[x1][y1]+=c;
b[x1][y2+1]-=c;
b[x2+1][y1]-=c;
b[x2+1][y2+1]+=c;
}
signed main()
{
cin>>n;
for(int i =1;i<=n;i++)
{
int x,y,r;
cin>>x>>y>>r;
x+=2000,y+=2000;
dian[i] = {x,y,r};

}
for(int i = 1;i<=5000;i++)
{
for(int j = 1;j<=5000;j++)
{
b[i][j] = b[i][j] + b[i-1][j] + b[i][j-1] - b[i-1][j-1];
}
}
cin>>q;
while(q--)
{
int x0,y0;
cin>>x0>>y0;
x0+=2000,y0+=2000;
cout <<b[x0][y0]<<endl;
}
return 0;
}
```

#网易互娱##网易互娱笔试#

2
1

1

8 21 评论