Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
128155 XIAOXINGYUN 计算函数值 C++ 通过 100 0 MS 260 KB 296 2024-01-25 14:04:21

Tests(5/5):


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


测评信息: