Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
103228 夏梓瑞 22第n项的数 C++ Wrong Answer 1 MS 272 KB 481 2024-12-28 14:37:21

Tests(1/5):


Code:

#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()\fabs() #include<ctime> #include<cstdlib> using namespace std; int main(){ int n,a,b,c,d,e=0; cin>>n>>a>>b>>c>>d; if(b-a==d-c){ e=d-c; n=a+e*(n-1); cout<<n; }else{ e=d/c; n=a*e*(n-1); cout<<n; } return 0; }


Run Info:

------Input------
5 1 2 4 8
------Answer-----
16
------Your output-----
8