题解 | #递推数列#
递推数列
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;
}