Advertisement
rotti321

T10 SIII ex3

May 17th, 2021
799
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     int x,poz=1,y;
  7.     cin >> y;
  8.     while(cin >> x){
  9.         if(x<y)         poz++;
  10.     }
  11.     cout<<poz;
  12. }
  13.  
  14. /*Algoritmul are o complexitate de O(n), unde n reprezinta numarul de numere intregi citite din fisier
  15. Algoritmul este eficient dpdv al memoriei, deoarece foloseste doar 3 variabile de tip intreg
  16.  
  17. Algoritmul retine primul numar intr-o variabila de tip intreg si numara cate dintre numere din fisier
  18. sunt mai mici decat acesta.
  19.  
  20. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement