1. 程式人生 > 其它 >1453: [藍橋杯2019初賽]數列求值

1453: [藍橋杯2019初賽]數列求值

技術標籤:藍橋杯c++

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; }