小X的密码破译

在这里插入图片描述
.
.
.
.
.
程序:

#include<iostream>
#include<cstdio>
using namespace std;
bool f[11111112];
int main()
{
	int a,b,c,n,x=11111111;
	scanf("%d%d%d%d",&n,&a,&b,&c);
	for (int i=1;i<=n;i++)
		f[((long long)a*i*i+b*i+c)%x]=true;
	int ans=0;
	int tj=0;
	for (int i=0;i<x;i++)
	if (f[i]==true)
	{
		tj++;
		ans=((long long)tj*i+ans)%x;
	}
	printf("%d",ans);
	return 0;
}
原文地址:https://www.cnblogs.com/YYC-0304/p/10292821.html