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 雪黛依梦 阅读(92) 评论(0)  编辑 收藏 引用

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


<2025年11月>
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456

常用链接

留言簿(4)

随笔分类

随笔档案

文章档案

搜索

  •  

最新评论

阅读排行榜

评论排行榜