Cod sursa(job #187553)

Utilizator tiger_snowIacob Andrei Bogdan tiger_snow Data 4 mai 2008 17:19:54
Problema Secventa Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.37 kb
#include<fstream.h>
int main()
{
	int n,k,x[1000],i,max,ii;
   ifstream in("secventa.in");
   in>>n>>k;
   for(i=1;i<=n;i++)in>>x[i];
   in.close();
   max=x[1];
   for(i=1;i<=n;i++)
   {
	 	if(max<x[i])
      {
      	ii=i;
      	max=x[i];
      }
   }
	ofstream out("secventa.out");
   out<<ii<<" "<<(ii+k)<<" "<<max;
   out.close();
   return 0;
}