#include #include using namespace std;

int main() { int k, n; cin >> k >> n;

int count = 0; // 记录当前序列的项数
int num = 1; // 当前序列的值
int power = 0; // 当前序列的幂次

while (count < n) {
    int tmp = pow(k, power); // 当前幂次的值

    if (tmp >= num) { // 如果当前幂次的值大于等于当前序列的值
        if (count == n - 1) { // 如果当前序列是第n项
            cout << num << endl;
            break;
        }
        num++; // 更新当前序列的值
        count++; // 更新当前序列的项数
    }
    power++; // 幂次加1
}

return 0;

}

求k的方幂序列的第n项

原文地址: https://www.cveoy.top/t/topic/qvnc 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录