提交时间:2024-10-27 09:21:53
运行 ID: 54297
#include<bits/stdc++.h> using namespace std; int main(){ int num; double sum = 1, temp = 1, x; cin >> x >> num; for(int i = 1; i <= num; i++){ temp = temp * x; sum = sum + temp; } cout << fixed << setprecision(2) << sum << endl; return 0; }