zoukankan      html  css  js  c++  java
  • F(N) hdu 2802(循环节)

    http://acm.hdu.edu.cn/showproblem.php?pid=2802

    分析:一猜这道题就该是规律,就是怎么样也没想到周期那么大(4018),我的悲伤比它还大(%>_<%)

    #include <iostream>
    #include <stdio.h>
    #include <string.h>
    #include <string>
    #include <vector>
    #include <algorithm>
    #include <map>
    #include <queue>
    #include <stack>
    #include <math.h>
    
    using namespace std;
    
    #define met(a, b) memset(a, b, sizeof(a))
    #define maxn 10000
    #define INF 0x3f3f3f3f
    const int MOD = 1e9+7;
    
    typedef long long LL;
    int a[maxn];
    
    int main()
    {
        int n;
    
        a[1]=1;
        a[2]=7;
    
        for(int i=3; i<4018; i++)
        {
            a[i]=a[i-2]+3*i*i-3*i+1;
            a[i] %= 2009;
        }
    
        while(scanf("%d", &n), n)
        {
            n %= 4018;
          printf("%d
    ",a[n]);
        }
    
        return 0;
    }
    View Code
  • 相关阅读:
    2、基础知识点回顾
    jQuery事件二
    71、auth模块、bbs项目关系表
    PYthon-4.26作业
    PYthon-线程
    PYthon-4.23作业
    PYthon-4.15作业
    PYthon-4.9作业
    PYthon-4.7作业
    PYthon-3.31作业
  • 原文地址:https://www.cnblogs.com/daydayupacm/p/5762567.html
Copyright © 2011-2022 走看看