Advertisement
catalyn

prob. 4 sIII var 2015 iunie-iulie

Nov 17th, 2015
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4. ifstream f("date.in");
  5. ofstream g("date.out");
  6.  
  7. int n,x,y;
  8. bool v[100];
  9.  
  10.  
  11.  
  12. int main()
  13. {
  14.  
  15. int i,ok=0;
  16. while(f>>x)
  17.  
  18. v[x]=true;
  19. i=0;
  20. while(i<99)
  21. if(v[i]==1&&v[i+1]==0)
  22. {
  23. x=i;
  24. i++;
  25.  
  26. while(v[i]==0&&i<99)
  27. i++;
  28. if(v[i]==1)
  29. {
  30. cout<<x<<" "<<i<<'\n';
  31. ok=1;}
  32.  
  33. }
  34. else
  35. i++;
  36.  
  37. if(ok==0)
  38. cout<<"nu exista";
  39.  
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement