fork(1) download
  1. #include <bits/stdc++.h>
  2. #define ll long long
  3. using namespace std;
  4. int main()
  5. {
  6. //std::ios_base::sync_with_stdio(false);
  7. double l , r , k ;int flag =0 ;
  8. cin >> l >> r >> k ;
  9. double no = 1;
  10. while(1)
  11. {
  12. if( no >= l && no <= r)
  13. {
  14. cout << (ll)no << " " ;
  15. flag = 1;
  16. }
  17. if(no >= r)
  18. break ;
  19. no = no*k ;
  20. }
  21. if(!flag)
  22. cout << "-1" << endl;
  23. return 0;
  24. }
Success #stdin #stdout 0s 3464KB
stdin
1 999999999999999999 1000000000
stdout
1 1000000000 1000000000000000000