1084.爬楼梯加强版
#include <stdio.h>
int main()
{
unsigned long long a,b,c,a1,b1;
int i,n;
while(scanf("%d",&n )!=EOF)
{
if(n==1||n==2)
{
printf("%d\n",n);
}
else if(n == 3)
{
printf("4\n");
}
else if(n>3)
{
a = 1;
b = 2;
c = 4;
for(i=4;i<=n;i++)
{
a1 = a;
b1 = b;
a = b;
b = c;
c = a1+b1+c;
}
if(c>=1000000007)
{
c%=1000000007;
}
printf("%lld\n",c);
}
}
return 0;
}
没过QAQ