Advertisement
Guest User

Untitled

a guest
Mar 17th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. #include <cmath>
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. int n,a[100];
  6.  
  7. int main(){
  8. int p,i;
  9. cin >> n;
  10. for(int i=1; i<=n; ++i)
  11. cin >> a[i];
  12. for( p=n;p>=1;p--)
  13. if(sqrt(a[p])==sqrt(a[p])){
  14. for( i=n;i>=p;--i)
  15. a[i+1] = a[i];
  16. n++;
  17. a[p] = sqrt(a[p]);
  18. }
  19. for( i=1;i<=n;++i)
  20. cout << a[i] << " ";
  21. return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement