提交时间:2024-01-25 09:22:17
运行 ID: 127516
#include<bits/stdc++.h> #include<stdio.h> using namespace std; int main(){ double temp=-1,ans=0; double x,n; cin>>x>>n; for(int i=1;i<=n;i++){ temp*=x; temp*=-1; ans+=temp; } printf("%.2f",ans); }