2015
04-16

# Sequence Folding

Alice and Bob are practicing hard for the new ICPC season. They hold many private contests where only the two of them compete against each other. They almost have identical knowledge and skills, the matter which results many times in ties in both the number of problems solved and in time penalty! To break the tie, Alice and Bob invented a tie breaker technique called sequence folding! The following are the steps of this technique:
1- Generate a random integer N >= 2.
2- Generate a sequence of N random integers.
3- If N = 2 go to step 6.
4- Fold the sequence by adding the Nth element to the first, the N-1th element to the second and so on, if N is odd then the middle element is added to itself, figure 1 illustrates the folding process.
5- Set N = ceil (N/2) and go to step 3.
6- The sequence now contains two numbers, if the first is greater than the second then Alice wins, otherwise Bob wins.

Figure 1.a Before Folding

Figure 1.b After one step of folding

Figure 1.c After two steps of folding, Alice wins!

In this problem you’re given the sequence of N integers and are asked determine the contest winner using the sequence folding tie breaker technique.

The first line contains T (1 <= T <= 100), the number of test cases. The first line of each test case contains an integer (2 <= N <= 100), the number of elements of the sequence. The next line contains N space separated integers. The sum of any subset of the numbers fit in a 32 bit signed integer.

The first line contains T (1 <= T <= 100), the number of test cases. The first line of each test case contains an integer (2 <= N <= 100), the number of elements of the sequence. The next line contains N space separated integers. The sum of any subset of the numbers fit in a 32 bit signed integer.

2
5
2 5 10 3 -4
3
5 4 -3

Case #1: Alice
Case #2: Bob

int a[110];
int main(){
int t;
scanf("%d",&t);
int ca = 1;
while(t--){
int n;
scanf("%d",&n);
int i,j;
for(i=1;i<=n;i++)scanf("%d",&a[i]);
int win = 0;
i = 1,j = n;
while(1){
if(j-i+1==2){
if(a[1]>a[2])win = 1;
else win = 2;
break;
}
int ii = i,jj = j;
while(ii<=jj){
a[ii++] += a[jj--];
}
i = 1,j = (j+1)/2;
}
printf("Case #%d: ",ca++);
if(win==1)puts("Alice");
else if(win==2)puts("Bob");
}
return 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.

2. 算法是程序的灵魂，算法分简单和复杂，如果不搞大数据类，程序员了解一下简单点的算法也是可以的，但是会算法的一定要会编程才行，程序员不一定要会算法，利于自己项目需要的可以简单了解。