蓝桥杯第十届 c/c++ b组 第20190324项
题目:
给定1,1,1,3,5,9,17…,从第四项开始,没想都是前3项的和,求第20190324项的最后4位数字
答案:4659
代码:
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int a=1;
int b=1;
int c=1;
int s=1;
while(s!=20190324)
{
int t1=b;
int t2=c;
c=(a+b+c)%10000;
a=t1%10000;
b=t2%10000;
s++;
}
cout<<a<<endl;
return 0;
}