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 }

 

posted @ 2018-10-27 14:18  Melted_czj  阅读(179)  评论(0编辑  收藏  举报
body { background-color:whitesmoke; } // 修改背景颜色为半透明 #home,#sideBarMain>div,#blog-sidecolumn>div>div,.catListView{ background-color:rgba(255,255,255,0); } // 修改其他边框的颜色