Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
127700 B班---刘鸿晖 计算函数值 C++ 通过 100 0 MS 248 KB 246 2024-01-25 09:58:08

Tests(5/5):


#include<bits/stdc++.h> using namespace std; int main(){ double x,n,sum=0; cin>>x>>n; long long y=x; for(int i=1;i<=n;i++){ if(i%2==1){ sum+=y; } else{ sum-=y; } y*=x; } cout<<fixed<<setprecision(2)<<sum; }


测评信息: