提交时间:2024-10-27 10:07:15

运行 ID: 54317

#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; }