UOJ Logo

NOI.AC

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#212752#3827. Awangliwen123456Compile Error//C++614b2024-10-20 10:30:082024-10-20 12:41:20

answer

#include <bits/stdc++.h>
using namespace std;

int n,m,f[N],cnt[N][150];
void solve()
{
	cin>>n>>m;
	set<int>a;
	for(int i=1;i<=n;i++)
	{
		int x;
		cin>>x;
		set<int>s;
		for(int j=1;j<=x/j;j++)
		{
			if(x%j==0)
				s.insert(j),s.insert(x/j);
		}
		int num=s.size();
		f[i]=num;
		a.insert(num);
	}
	
	for(int i=1;i<=n;i++)
		for(int j=1;j<=128;j++)
		{
			cnt[i][j]=cnt[i-1][j];
			if(f[i]==j)cnt[i][j]++;
		}
	while(m--)
	{
		int l,r;
		cin>>l>>r;
		int ans=0;
		for(int i=1;i<=128;i++)
		{
			int t=cnt[r][i]-cnt[l-1][i];
			ans+=t*(t-1)/2;
		}
		cout<<ans<<endl;
	}
}

Details

answer.code:4:11: error: 'N' was not declared in this scope
 int n,m,f[N],cnt[N][150];\x0d
           ^
answer.code:4:18: error: 'N' was not declared in this scope
 int n,m,f[N],cnt[N][150];\x0d
                  ^
answer.code: In function 'void solve()':
answer.code:20:3: error: 'f' was not declared in this scope
   f[i]=num;\x0d
   ^
answer.code:27:4: error: 'cnt' was not declared in this scope
    cnt[i][j]=cnt[i-1][j];\x0d
    ^
answer.code:28:7: error: 'f' was not declared in this scope
    if(f[i]==j)...