1:
We define points as 0-dimensional elements, lines as 1-dimensional elements, polygons as 2-dimensional elements ...
Since a low-dimensional super-body translates a high-dimensional super-square in the corresponding new axis, such as a two-dimensional super-body as a polygon, and then expands along the new z-axis, a low-dimensional element increases one-dimension into a high-dimensional element, such as a point becoming a line, a line becoming a polygon, a polygon becoming a body
So there's a push-through:
The high-dimensional elements are derived from the elements of the first dimension, and the same-dimensional elements are copied.
That is, after the ascending dimension of a super-dimensional body, the number of the dimension i-dimensional elements of the super-dimension will be the number of the *2+ (i-1) dimension of the original super-square body.
Then through the derivation of the Ghost animal/Luck law, you can get a combination number formula,
Finally add a linear sieve inverse element, pay attention to the memory can be too.
2:
Starting with the degree relationship of an element, there is a rule:
An x-dimensional element corresponds to the number of x-1 elements fixed, such as a line forever two points, a face forever 4 points ... the I-dimension element corresponds to 2i (i-1) dimension elements. The number of x+1 dimension elements corresponding to the X-dimension element increases with the increase of the dimension, for example, two-dimensional hyper-body (polygon) in a point and a line, three-dimensional (cube) 1.3 lines, namely:
An x-dimensional element corresponds to (y-x) a (x+1) dimension element in Y dimension.
Then, according to the multiplication of the points, we can get the number of the 0-dimensional element (point) of the super-body, and then according to the formula can deduce the number of higher dimension elements, so it can be O (n) out of the solution, but because the various models, but also need a linear sieve inverse ~ ~
My method is this, unfortunately ... Fast power long Long is written in int!!!!! Weak dead.
Code:
#include <cstdio> #include <cstring> #include <iostream> #include <algorithm> #define N 10001000using namespace Std;int n,p;long long A[2];long long Inv[n];long long power (long long x,int k) {Long long ans=1;whi Le (k) {if (k&1) ans*=x,ans%=p;x*=x,x%=p;k>>=1;} return ans;} void Getinv (int x) {inv[1]=1;for (int i=2;i<=x;i++) inv[i]= (Long Long) (p-p/i) *inv[p%i]%p;} int Now,last;int Main () {int i,j,k;scanf ("%d%d", &n,&p); now=0,last=1; A[0]=power (2,n); GETINV (n); long long ans=a[0];for (i=1;i<=n;i++) {now^=1,last^=1; a[now]=a[last]* (n-i+1)%p*inv[i]%p*inv[2]%p;ans^=a[now];} Cout<<ans<<endl;fclose (stdin); fclose (stdout); return 0;}
"BZOJ3823" "east! simulation game _round5t1" token of the pledge formula + linear sieve inverse element (push formula method than the author of the Simple)