1453: [蓝桥杯2019初赛]数列求值

2019省赛A组第2题 数列求值

题目链接http://oj.ecustacm.cn/problem.php?id=1453
答案:4659

#include<iostream>
using namespace std;
long long a[20190325] = {
    
     1,1,1 };
int main() {
    
    
	for (int i = 3; i < 20190324; i++) {
    
    
		a[i] = (a[i - 1] % 10000 + a[i - 2] % 10000 + a[i - 3] % 10000)%10000;
	}
	printf("%lld", a[20190323]);
	return 0;
}

猜你喜欢

转载自blog.csdn.net/weixin_46028214/article/details/113083371