//目录

noi 9271 奶牛散步

题目链接:http://noi.openjudge.cn/ch0206/9271/

同noi 踩方格,但是题目有问题,%12345,我也是看了discuss才知道的。

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

unsigned long long d[1005];

int main()
{
    d[1] = 3;
    d[2] = 7;
    for(int i=3;i<=1001;i++)
        d[i] = (2*d[i-1] + d[i-2])%12345;

    int n;
    scanf("%d",&n);
    printf("%lld\n",d[n]);
    return 0;
}
View Code

 

posted @ 2016-11-04 20:56  小草的大树梦  阅读(351)  评论(0编辑  收藏  举报