Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
31197 | 惠子铭 | 计算多项式的值 | C++ | Compile Error | 0 MS | 0 KB | 292 | 2023-11-17 20:57:27 |
#include<cstdio> #include<cstring> #include<cmath> using namespace std; int main() { float x; int n; float tot=0; cin>>x>>n; int a=n; for(int i=n;i>=1;i--) { tot=tot+pow(x,a); a--; } printf("%.2f",tot+1); return 0; }