Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
96952 | 任斌 | 22第n项的数 | C++ | Wrong Answer | 0 MS | 284 KB | 290 | 2024-11-10 09:25:16 |
#include<bits/stdc++.h> using namespace std; int main() { int n,a[10000],d1,d2,q; cin>>n; for(int i=1;i<=4;i++){ cin>>a[i]; } d1=a[2]-a[1]; d2=a[3]-a[2]; q=a[2]/a[1]; if(d2==d1){ cout<<a[1]+(n-1)*d1<<endl; } else cout<<a[1]*pow(q,(n-1)); return 0; }
------Input------
10 1 5 25 125
------Answer-----
1953125
------Your output-----
1.95312e+06