10月28日 小X的密码破译

题目

   

分析

     水

     注意: 开longlong,不能强制转换longlong会烂掉

      要用int  

代码

 1 #include<iostream>
 2 #include<cstdio>
 3 using namespace std;
 4 bool f[111111130];
 5 const int m=11111111;
 6 int main()
 7 {
 8     int n,a,b,c;
 9     scanf("%d%d%d%d",&n,&a,&b,&c);
10     for (int i=1;i<=n;i++)
11         f[((long long)a*i*i+b*i+c)%m]=true;
12     int ans=0,x=0;
13     for (int i=0;i<m;i++)
14     {
15         if (f[i])
16         {
17             x++;
18             ans=((long long)x*i+ans)%m;
19         }
20     }
21     printf("%d",ans);
22     return 0;
23 }

猜你喜欢

转载自www.cnblogs.com/zjzjzj/p/9861059.html