Cod sursa(job #303235)
Utilizator | FMI - vacaroiu andrei andreiv | Data | 9 aprilie 2009 17:48:29 |
---|---|---|---|
Problema | Xor Max | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.37 kb |
#include <stdio.h>
int main()
{long x,n,i,st,stt,stp,y,max,s;
freopen("xormax.in","r",stdin);
freopen("xormax.out","w",stdout);
scanf("%ld",&n);scanf("%ld",&s);st=1;max=s;stt=1;stp=1;
for (i=2;i<=n;i++)
{scanf("%ld",&x);
if (x>(s^x)) {s=x;st=i;} else s=s^x;
if (s>max) {max=s;stt=st;stp=i;}
}
printf("%ld %ld %ld\n",max,stt,stp);
return 0;
}