Advertisement
Guest User

Parells creixents

a guest
Oct 25th, 2014
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. int main() {
  6.  
  7.     int n = 0;
  8.     cin >> n;
  9.     bool ultim = false;
  10.     bool sequencia = false;
  11.     int zero = 0;
  12.    
  13.    
  14.     while (!sequencia) {
  15.        int count = 0;
  16.        int x, y;
  17.        cin >> x;
  18.        while (!ultim) {
  19.        cin >> y;
  20.        if (x < y) count++;
  21.        x = y;
  22.        if (x == 0) ultim = true;
  23.        }
  24.        
  25.        ultim = false;
  26.        
  27.        zero++;
  28.        if (zero == n) sequencia = true;
  29.        
  30.        cout << count << endl;
  31.      
  32.     }
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement