Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include <cmath>
- #include<iomanip>
- using namespace std;
- void print(int *a, int b){
- for (int i = 0; i < b; i++){
- cout << a[i] << ' ';
- }
- cout << endl;
- }
- void fill(int *a, int b){
- for (int i = 0; i < b; i++){
- cin >> a[i];
- }
- }
- bool isPower(int b, int a){
- double s = log(b) / log(a);;
- return s == (int)s;
- }
- int main(){
- int *a;
- int b, c, d, e;
- cin >> b;
- a = new int[b];
- fill(a, b);
- cin >> c;
- d = 0;
- for (int i = 0; i < b; i++){
- if (isPower(a[i], c)){
- d++;
- }
- }
- cout << d;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement