fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int tab[1000000];
  5. int main(){
  6. int ile, liczba = 0, licznik = 0, max = 0;
  7. cin >> ile;
  8. while(cin >> tab[licznik]){
  9. licznik++;
  10. }
  11. for(int i = 0; i < licznik - ile + 1; i++){
  12. for(int j = i; j < ile + i; j++){
  13. if(tab[j] > max)
  14. max = tab[j];
  15. }
  16. cout << max << endl;
  17. max = 0;
  18. }
  19. }
Success #stdin #stdout 0.01s 5536KB
stdin
5
5 2 3 4 3 7 4 5
stdout
5
7
7
7