BZOJ3028: Food

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.