提交时间:2024-01-26 15:43:27
运行 ID: 129029
#include<bits/stdc++.h> using namespace std; int main(){ int x,n; cin>>x>>n; double tmp=0; for(int i=1;i<=n;i++){ if(i%2==1) tmp+=pow(x,i); else tmp-=pow(x,i); } printf("%.2f",tmp); }