Cod sursa(job #309421)

Utilizator andrici_cezarAndrici Cezar andrici_cezar Data 30 aprilie 2009 11:36:38
Problema Xor Max Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.33 kb
#include<fstream.h>  
long s,n,i,max,c,xx,yy,z;

int main()
{
ifstream f("xormax.in");
ofstream g("xormax.out");
f>>n;
f>>c;
s=c;
max=-20000000;
for (i=2;i<=n;i++)
    {
    f>>c;
    if ((s^c)<s) {s=c;z=i;}
    else s=s^c;
    if (max<s) {max=s;xx=z;yy=i;}
    }
g<<max<<' '<<xx<<' '<<yy<<'\n';
g.close();
return 0;
}