1. 程式人生 > >HustOJ - 1010

HustOJ - 1010

++ 分享 lose open pri color src pen spa

技術分享
 1 #include<stdio.h>
 2 int main()
 3 {
 4     int a,b,s,t,i,j;
 5     while((scanf("%d",&a)==1))
 6     {
 7         if (a<=12&&a>=1)
 8         {
 9             t=0;
10             for (i=1;i<=a;i++)
11             {
12                 s=1;
13                 for (j=1;j<=i;j++)
14 { 15 s=s*j; 16 } 17 t=t+s; 18 } 19 printf("%d\n",t); 20 } 21 } 22 }
1010 菲波那契數

HustOJ - 1010