Cod sursa(job #276534)
Utilizator | Data | 11 martie 2009 11:02:29 | |
---|---|---|---|
Problema | Secventa | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.28 kb |
#include<fstream.h>
void main()
{unsigned int n,k,imax,i; long int x,max;
ifstream f("secventa.in"); ofstream g("secventa.out");
f>>n>>k; f>>x; max=x; imax=1;
for(i=2;i<=n-k+1;i++)
{f>>x;
if(x>max) {max=x; imax=i;}
}
g<<imax<<" "<<imax+k-1<<" "<<max;
g.close(); f.close();
}