题解 | #递推数列#

递推数列

https://www.nowcoder.com/practice/d0e751eac618463bb6ac447369e4aa25

#include <stdio.h>

int main() {
    int a0,a1,p,q,k;
    scanf("%d %d %d %d %d",&a0,&a1,&p,&q,&k);
    int temp;
    for(int i=2;i<=k;i++){
        temp=(p*a1+q*a0)%10000;
        a0=a1;
        a1=temp;
    }
    printf("%d",temp);
    return 0;
}

全部评论

相关推荐

ResourceUtilization:四六级不愧是大学最有用的证之一
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务