Advertisement
selfpromise

64 for girlfriend

Mar 15th, 2020
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int main()
  5. {
  6. int a[100];int n;
  7. cin>>n;
  8. for (int i=0;i<n;i++)
  9. cin>>a[i];
  10. for (int i=0;i<n;i++)
  11. {
  12. if (a[i]<0)
  13. {
  14. for (int j=i;j<n-1;j++)
  15. a[j]=a[j+1];
  16. break;
  17. }
  18. }
  19. n--;
  20. bool f=0; int mn,ind;
  21. for (int i=0;i<n;i++)
  22. {
  23. if (a[i]>0)
  24. {
  25. if (f==0)
  26. {
  27. f=1;
  28. mn=a[i];
  29. ind=i;
  30. }
  31. else
  32. {
  33. if (a[i]<mn)
  34. {
  35. mn=a[i];
  36. ind=i;
  37. }
  38. }
  39. }
  40. }
  41. for (int i=ind;i<n-1;i++)
  42. a[i]=a[i+1];
  43. n--;
  44. for(int i=0;i<n;i++)
  45. cout<<a[i]<<" ";
  46. return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement