#include <stdio.h>
/*
*J
*L_1
*100
*/
int main(int argc, char *argv[])
{
static int a = 1,b = 1;
int choose;
int cycle;
int h = 100;
static int ans;
scanf("%d",&choose);
if(choose == 1||choose == 2)
{
printf("%d
",1);
return 0;
}
for(cycle = 2;cycle < choose;cycle++)
{
ans = a + b;
a = b%10007;
b = ans%10007;
}
ans = ans%10007;
printf("%d
",ans);
ans = 0;
a = 1;
b = 1;
return 0;
}
这个题目的关键在于,数据的取模。因为数据无法直接存储。
所以只能在运算过程中处理,
因此在数据的运算中每次都取模10007
这样就得到结果了!!