posts - 99,  comments - 8,  trackbacks - 0
超时代码:
#include <stdio.h>
#include 
<stdlib.h>
int a, b;

int com (int n)
{
    
if (n == 1 || n == 2)
    
return 1;
    
else
    
return ( a * com( n - 1 )+ b * com(n - 2) ) % 7;         
}


int main ()
{
    
    
int n;
    
while ( scanf ("%d %d %d"&a, &b, &n) != EOF && ( a != 0 && b != 0 && n != 0 ))
    
{
          
          printf ("%d\n", com(n));
   }

    system (
"pause");
    
return 0;
}

posted on 2010-08-23 21:39 雪黛依梦 阅读(74) 评论(0)  编辑 收藏 引用

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理


<2010年8月>
25262728293031
1234567
891011121314
15161718192021
22232425262728
2930311234

常用链接

留言簿(4)

随笔分类

随笔档案

文章档案

搜索

  •  

最新评论

阅读排行榜

评论排行榜