Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
96454 | 梁敖铭 | 22第n项的数 | C++ | Accepted | 0 MS | 288 KB | 463 | 2024-11-09 08:12:26 |
#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 m,x[10]; cin>>m; for(int i=0;i<4;i++){ cin>>x[i]; } int a=x[1]-x[0]; int b=x[2]-x[1]; if(a==b){ cout<<x[0]+(m-1)*a; } else{ cout<<int(x[0]*pow(x[1]/x[0],m-1)); } return 0; }