Codeforces Round #153 (Div. 2) A. Little Xor

题目:http://www.codeforces.com/problemset/problem/252/A

输出元素格个小于100的数列中连续子数列的异或最大值 

思路:个数小于100 直接枚举

#include <iostream>
#include <stdio.h>

using namespace std;

int arr[100];
int ans=0;

int main()
{
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    for(int i=0;i<n;i++)
    {
        int t=0;
        for(int j=i;j<n;j++)
        {
            t^=arr[j];
            if(t>ans) ans=t;
        }
    }
    cout << ans;
    return 0;
}

 

posted @ 2013-01-17 21:03  Daniel Qiu  阅读(127)  评论(0编辑  收藏  举报