BZOJ 3028 食物 母函数

题目大意、题解:http://wyfcyx.is-programmer.com/posts/76787.html


CODE:

#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define MAX 510
#define MO 10007
using namespace std;
 
char s[MAX];
 
int main()
{
    scanf("%s",s);
    int length = strlen(s);
    int re = 0;
    for(int i = 0; i < length; ++i)
        re *= 10,re += s[i] - '0',re %= MO;
    re = re * (re + 1) % MO * (re + 2) % MO;
    re = re * 1668 % MO;
    cout << re << endl;
    return 0;
}


你可能感兴趣的:(数论,数学,生成函数,bzoj,母函数)