Advertisement
a53

Cartonase2

a53
Feb 5th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int p,m;
  7. cin>>p>>m;
  8. int n=p-m,v[1001];
  9. for(int i=1;i<=n;++i)
  10. cin>>v[i];
  11. for(int i=1;i<n;++i)
  12. for(int j=i+1;j<=n;++j)
  13. if(v[i]>v[j])
  14. swap(v[i],v[j]);
  15. int r=(v[n]-v[1])/(p-1),x=v[1];
  16. for(int i=2;i<=n&&m>0;)
  17. {
  18. x+=r;
  19. if(x!=v[i])
  20. cout<<x<<' ',--m;
  21. else
  22. ++i;
  23. }
  24. return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement