Cod sursa(job #309399)
Utilizator | Data | 30 aprilie 2009 10:29:50 | |
---|---|---|---|
Problema | Xor Max | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.31 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;
}