Pagini recente » Cod sursa (job #2673020) | Cod sursa (job #1790761) | Cod sursa (job #1635653) | Cod sursa (job #2455529) | Cod sursa (job #1806013)
#include <iostream>
#include <fstream>
#define Nmax 100001
using namespace std;
long n,v[Nmax],imax,kmax;
long long x,xmax=0;
int main()
{ ifstream f("xormax.in");
ofstream g("xormax.out");
long i,k;
f>>n;
for(i=1;i<=n;i++)
f>>v[i];
for(i=1;i<n;i++)
{
x=v[i];
for(k=1;k<=n-i;k++)
{ x=x^v[i+k];
if(x>xmax)
{
xmax=x;
imax=i;
kmax=k;
}
}
}
g<<xmax<<' '<<imax<<' '<<imax+kmax<<endl;
return 0;
}