2014
11-05

# Bi-peak Number

A peak number is defined as continuous digits {D0, D1 … Dn-1} (D0 > 0 and n >= 3), which exist Dm (0 < m < n – 1) satisfied Di-1 < Di (0 < i <= m) and Di > Di+1 (m <= i < n – 1).
A number is called bi-peak if it is a concatenation of two peak numbers.

The score of a number is the sum of all digits. Love8909 is crazy about bi-peak numbers. Please help him to calculate the MAXIMUM score of the Bi-peak Number in the closed interval [A, B].

The first line of the input is an integer T (T <= 1000), which stands for the number of test cases you need to solve.
Each case consists of two integers “A B” (without quotes) (0 <= A <= B < 2^64) in a single line.

The first line of the input is an integer T (T <= 1000), which stands for the number of test cases you need to solve.
Each case consists of two integers “A B” (without quotes) (0 <= A <= B < 2^64) in a single line.

3
12121 12121
120010 120010
121121 121121

Case 1: 0
Case 2: 0
Case 3: 8

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define ll unsigned __int64
#define go(x) ret=max(ret,dfs(p-1,d||i>l[p],u||i<r[p],i,sm+i,x))
int c=0,T,l[20],r[20],len,dp[20][10][150][7],ma[20][2][2][10][7];
ll A,B;
int dfs(int p,int d,int u,int ls,int sm,int s)
{
if(p<0)return (s==6)?sm:0;
int &ans=dp[p][ls][sm][s];
if(d&&u&&ans!=-1)return ans;
int ret=0;
int i=d?0:l[p],ed=u?9:r[p];
for(;i<=ed;i++)
{
if(s==0)go(i==0?0:1);
else if(s==1&&i>ls)go(2);
else if(s==2&&i!=ls)go(i<ls?3:2);
else if(s==3){if(i<ls)go(3);if(i>0)go(4);}
else if(s==4&&i>ls)go(5);
else if(s==5&&i!=ls)go(i<ls?6:5);
else if(s==6&&i<ls)go(6);
}
if(u&&d)ans=ret;
return ret;
}
void sol(ll x,int *a)
{
for(int i=0;i<20;i++)a[i]=0;
int t=0;
for(;x;x/=10)a[t++]=x%10;
if(t>len)len=t;
}
int main()
{
memset(dp,-1,sizeof(dp));
scanf("%d",&T);
while(T--)
{
scanf("%I64u%I64u",&A,&B);
len=0;
sol(A,l);sol(B,r);
printf("Case %d: %d\n",++c,dfs(len-1,0,0,0,0,0));
}
}

1. Hello Web Admin, I noticed that your On-Page SEO is is missing a few factors, for one you do not use all three H tags in your post, also I notice that you are not using bold or italics properly in your SEO optimization. On-Page SEO means more now than ever since the new Google update: Panda. No longer are backlinks and simply pinging or sending out a RSS feed the key to getting Google PageRank or Alexa Rankings, You now NEED On-Page SEO. So what is good On-Page SEO?First your keyword must appear in the title.Then it must appear in the URL.You have to optimize your keyword and make sure that it has a nice keyword density of 3-5% in your article with relevant LSI (Latent Semantic Indexing). Then you should spread all H1,H2,H3 tags in your article.Your Keyword should appear in your first paragraph and in the last sentence of the page. You should have relevant usage of Bold and italics of your keyword.There should be one internal link to a page on your blog and you should have one image with an alt tag that has your keyword….wait there's even more Now what if i told you there was a simple WordPress plugin that does all the On-Page SEO, and automatically for you? That's right AUTOMATICALLY, just watch this 4minute video for more information at.