百练 2758 菲波那契数列(2)

题目链接:http://bailian.openjudge.cn/practice/2758

# include 

int get(long int i)
{

	int a1=1,a2=1,ak,k;
	if(i>0&&i<3)
		return 1;
	else
	{
		for(k=3;k<=i;k++)
		{
			ak=a1+a2;
			a1=a2%1000;
			a2=ak%1000;
		}
	}
	return ak;
}

int main()
{
	int n,num,i,a;
	scanf("%d",&n);
	for(i=0;i



你可能感兴趣的:(百练题解)