$\sum_{k = 0} ^ {n} a_kx^k = \sum_{k = 0} ^ {n} b_k(x - t)^k \Leftrightarrow \sum_{k = 0} ^ {n} a_k(x + t)^k = \sum_{k = 0} ^ {n} b_kx^k$

把式子左边用二项式定理展开:

$b_m=\sum_{k=m}^nC_k^{k-m}t^{k-m}a_k\\=\sum_{k=0}^{n-m}C_{m+k}^k t^k a_{m+k}$

注意到$n - m \leq 5$,然后。。。然后就没有然后了

出题人都是*****!

 

  1 /**************************************************************
  2     Problem: 3933
  3     User: rausen
  4     Language: C++
  5     Result: Accepted
  6     Time:324 ms
  7     Memory:1148 kb
  8 ****************************************************************/
  9  
 10 #include <cstdio>
 11 #include <cstring>
 12 #include <algorithm>
 13  
 14 using namespace std;
 15 typedef long long ll;
 16 const int Len = 2e3 + 5;
 17 const int N = 3e3 + 5;
 18 const ll base = 1e9;
 19 const int mod = 3389;
 20  
 21 inline void print(int t, bool f);
 22  
 23 struct Big {
 24     ll x[Len];
 25     int len;
 26     Big(ll _ = 0) {
 27         memset(x, 0, sizeof(x));
 28         x[len = 1] = _;
 29     }
 30      
 31     inline ll& operator [] (int i) {
 32         return x[i];
 33     }
 34      
 35     inline void get() {
 36         static char st[N];
 37         static int i, l, tmp;
 38         memset(x, 0, sizeof(x));
 39         gets(st + 1), l = strlen(st + 1);
 40         for (i = l; i; --i) {
 41             if ((l - i) % 9 == 0) tmp = 1;
 42             x[(l - i) / 9 + 1] += 1ll * (st[i] - '0') * tmp, tmp *= 10;
 43         }
 44         len = (l - 1) / 9 + 1;
 45     }
 46     inline void put(char ch = '\n') {
 47         static int i;
 48         for (print(x[len], 0), i = len - 1; i; --i)
 49             print(x[i], 1);
 50         putchar(ch);
 51     }
 52      
 53     inline Big operator + (const Big &b) const {
 54         static Big res;
 55         static int i;
 56         res = 0, res.len = max(len, b.len);
 57         for (i = 1; i <= res.len; ++i) {
 58             res[i] += x[i] + b.x[i];
 59             if (res[i] >= base)
 60                 res[i] -= base, ++res[i + 1];
 61         }
 62         if (res[res.len + 1]) ++res.len;
 63         while (!res[res.len]) --res.len;
 64         return res;
 65     }
 66     inline Big& operator += (const Big &b) {
 67         return *this = *this + b;
 68     }
 69     inline Big& operator ++() {
 70         return *this += 1;
 71     }
 72      
 73     inline ll operator - (const Big &b) {
 74         static int i;
 75         static ll res;
 76         for (res = 0, i = len; i; --i)
 77             res = res * base + x[i] - b.x[i];
 78         return res;
 79     }
 80      
 81     inline Big operator * (const Big &b) const {
 82         static Big res;
 83         static int i, j;
 84         res = 0, res.len = len + b.len;
 85         for (i = 1; i <= len; ++i)
 86             for (j = 1; j <= b.len; ++j) {
 87                 res[i + j - 1] += x[i] * b.x[j];
 88                 res[i + j] += res[i + j - 1] / base, res[i + j - 1] %= base;
 89             }
 90         for (i = 1; i <= res.len; ++i)
 91             res[i + 1] += res[i] / base, res[i] %= base;
 92         while (!res[res.len] && res.len) --res.len;
 93         if (!res.len) res.len = 1;
 94         return res;
 95     }
 96     inline Big& operator *= (const Big &b) {
 97         *this = *this * b;
 98     }
 99      
100     inline Big operator / (int t) const {
101         static Big res;
102         static int i;
103         res = *this;
104         for (i = len; i; --i)
105             res[i - 1] += (res[i] % t) * base, res[i] /= t;
106         res[0] = 0;
107         while (!res[res.len] && res.len) --res.len;
108         if (!res.len) res.len = 1;
109         return res;
110     }
111     inline Big& operator /= (int t) {
112         return *this = *this / t;
113     }
114      
115     ll operator % (int t) const {
116         static int i;
117         static ll res;
118         for (res = 0, i = len; i; --i)
119             res = (res * base + x[i]) % t;
120         return res;
121     }
122 } n, m, ans, C, p, t;
123  
124 inline int pow(int x, int y) {
125     static int res;
126     res = 1;
127     while (y) {
128         if (y & 1) res = res * x % mod;
129         x = x * x % mod, y >>= 1;
130     }
131     return res;
132 }
133  
134 inline int A(const Big &t) {
135     return (209 * pow(1234, t % (mod - 1)) + 3181) % mod;
136 }
137  
138 int main() {
139     int i, tmp;
140     n.get(), t.get(), m.get();
141     tmp = n - m, C = p = 1, ans = 0;
142     for (i = 0; i <= tmp; ++i, ++m) {
143         if (i) C = (C * m) / i, p *= t;
144         ans += C * p * A(m);
145     }
146     ans.put();
147     return 0;
148 }
149  
150 inline void print(int t, bool f) {
151     static int tmp, tot, pr[10];
152     if (t < 0) putchar('-'), tmp = -t;
153     else tmp = t;
154     tot = 0;
155     while (tmp)
156         pr[++tot] = tmp % 10, tmp /= 10;
157     if (f) for (tmp = 9 - tot; tmp; --tmp) putchar('0');
158     while (tot) putchar(pr[tot--] + '0');
159 }
View Code

 

posted on 2015-04-25 23:05  Xs酱~  阅读(470)  评论(0编辑  收藏  举报