第28次CSP第一题——现值计算

第28次CSP第一题——现值计算 题目网址https://sim.csp.thusaac.com/contest/28/problem/0以下解答仅供参考#include iostream #include cmath #include iomanip using namespace std; int main(){ int n; double i; cinni; double total0.0; for(int k0;kn;k){ int x; cinx; totalx*pow(1i,-k); } coutfixedsetprecision(3)totalendl; return 0; }运行结果