Advertisement
a53

Inserare2

a53
Jan 7th, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include <fstream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int m,n,x,Min,Max;
  7. ifstream f("inserare2.in");
  8. f>>m>>n;
  9. f>>Min;
  10. for(int i=2;i<=m;++i)
  11. f>>x;
  12. Max=x;
  13. int i=2,y;
  14. f>>x;
  15. ofstream g("inserare2.out");
  16. while(f>>y&&i<=n)
  17. {
  18. if(Min>x&&Max<y)
  19. {
  20. g<<i;
  21. break;
  22. }
  23. x=y;
  24. ++i;
  25. }
  26. if(i>n)
  27. g<<"imposibil";
  28. return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement