Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
119770 | 刘珩宇 | 22第n项的数 | C++ | Accepted | 1 MS | 276 KB | 465 | 2025-05-18 19:05:03 |
#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ int i,a,x,y,n[101]={0},s; cin>>a; for(i=0;i<4;i++){ cin>>n[i]; } x=n[1]-n[0]; y=n[2]-n[1]; if(x!=y){ s=n[0]*pow(n[1]/n[0],a-1); } else{ s=n[0]+(a-1)*(n[1]-n[0]); } cout<<s; return 0; }