Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
767 曾浩森 22第n项的数 C++ Accepted 0 MS 264 KB 507 2023-04-01 14:37:12

Tests(5/5):


Code:

#include<iostream> using namespace std; int c,r; int num(int a){ int k; if(a==1) k=1; else k=num(a-1)*c; return k; } int dc(int a){ if(a==1) r=1; else r=dc(a-1)+c; return r;} int main(){ int x,y,z,o,b; cin>>b; cin>>x>>y>>z>>o; if(y/x==o/z){ c=y/x; cout<<num(b); } else{ c=y-x; if(x%2==0) cout<<dc(b)+1; else cout<<dc(b); } }