Title: http://www.lydsy.com/JudgeOnline/problem.php?id=3028
The solving method: Lists the parent function to multiply the simplification after the expansion, uses the inserting the plate law to be able.
Code:
1#include <cstdio>2 3#include <cstdlib>4 5#include <cmath>6 7#include <cstring>8 9#include <algorithm>Ten One#include <iostream> A -#include <vector> - the#include <map> - -#include <Set> - +#include <queue> - +#include <string> A at #defineINF 1000000000 - - #defineMAXN 1000+5 - - #defineMAXM 200000+5 - in #defineEPS 1e-10 - to #definell Long Long + - #definePA pair<int,int> the * #defineFor0 (i,n) for (int i=0;i<= (n); i++) $ Panax Notoginseng #defineFor1 (i,n) for (int i=1;i<= (n); i++) - the #defineFor2 (i,x,y) for (int i= (x); i<= (y); i++) + A #defineFor3 (i,x,y) for (int i= (x); i>= (y); i--) the + #defineFor4 (i,x) for (int i=head[x],y=e[i].go;i;i=e[i].next,y=e[i].go) - $ #defineFor5 (N,M) for (int. i=1;i<=n;i++) for (int j=1;j<=m;j++) $ - #defineMoD 10007 - the #defineLCH K<<1,l,mid - Wuyi #defineRCH K<<1|1,mid+1,r the - using namespacestd; Wu -InlineintRead () About $ { - - intx=0, f=1;CharCh=GetChar (); - A while(ch<'0'|| Ch>'9'){if(ch=='-') f=-1; ch=GetChar ();} + the while(ch>='0'&&ch<='9') {x=Ten*x+ch-'0'; ch=GetChar ();} - $ returnx*F; the the } the intn,m; the CharS[MAXN]; - in intMain () the the { About theFreopen ("Input.txt","R", stdin); the theFreopen ("output.txt","W", stdout); + -scanf"%s", s); n=strlen (s); theFor0 (i,n-1) m= (m*Ten+s[i]-'0')%MoD;Bayicout<<m* (m+1)%mod* (m+2)%mod*1668%mod<<Endl; the the return 0; - -}View Code
BZOJ3028: Food