Algorithm
Code Examples
#1 Code Example with C++ Programming
Code -
C++ Programming
#include <bits/stdc++.h>
using namespace std;
long long k, l;
int main() {
scanf("%lld %lld", &k, &l);
long long tmp = k;
int res = 0;
while(k <= l) {
if(k == l) {
puts("YES");
printf("%d\n", res);
return 0;
}
k *= tmp;
++res;
}
puts("NO");
return 0;
}
Copy The Code &
Try With Live Editor
Input
Input
Copy
5
25
25
Output
YES
1
1
Demonstration
Codeforcess Solution Cifera, A. Cifera C,C++, Java, Js and Python ,Cifera,Codeforcess Solution