救救孩子吧!!!奇怪的编译错误
查看原帖
救救孩子吧!!!奇怪的编译错误
529038
Butterfly__qwq楼主2022/4/9 15:58
#include<bits/stdc++.h>
using namespace std;
struct pnt
{
	int x,y,num;
};
pnt pnts[21][21];
int read()
{
    int x=0,f=1;
	char ch=getchar();
    while(ch<'0'||ch>'9')
	{
		if(ch=='-')f=-1;
		ch=getchar();
	}
    while(ch>='0'&&ch<='9')
	{
		x=x*10+ch-'0';
		ch=getchar();
	}
    return x*f;
}
int cmp(pnt a,pnt b)
{
	return a.num>b.num;
}
int main()
{
	int m,n,k,ans,t,nx,ny,px,py;
	m=read();
	n=read();
	k=read();
	for(int i=0;i<m;i++)
    {
    	for(int j=0;j<n;j++)
    	{
    		pnts[i][j].x=i+1;
    		pnts[i][j].y=j+1;
    		pnts[i][j].num=read();
		}
    }
    sort(pnts,pnts+m*n,cmp);
    t=0;
    nx=0;
    ny=0;
	ans=0;
	for(int i=0;i<m;i++)
	{
		for(int j=0;j<n;j++)
		{
			px=abs(pnts[i][j].x-nx);
			py=abs(pnts[i][j].y-ny);
			t+=px;
			t+=py;
			if(t+pnts[i][j].x>k)break;
			ans+=pnts[i][j].num;
		}
	}
	cout<<ans;
	return 0;
}

我运行的时候,忽然跳到一个叫stl_algo.h的代码并在18491849行和18511851行报错,疑似电脑问题?algorithm出锅?

2022/4/9 15:58
加载中...