hdu2021
http://acm.hdu.edu.cn/showproblem.php?pid=10
Fibonacci的兔子問題要改了,mod 3的遞推數(shù)列肯定得有循環(huán)節(jié)吧,把第一個循環(huán)找到,{1,2,0,2,2,1,0,1},恰好是從第一位開始,OK:
ps:水題啊水題嘛。
Fibonacci的兔子問題要改了,mod 3的遞推數(shù)列肯定得有循環(huán)節(jié)吧,把第一個循環(huán)找到,{1,2,0,2,2,1,0,1},恰好是從第一位開始,OK:
#include<stdio.h>
int main()
{
int n,f[8]={1,2,0,2,2,1,0,1};
while (scanf("%d",&n)!=-1)
{
if (f[n%8]==0)
printf("yes\n");
else
printf("no\n");
}
}
int main()
{
int n,f[8]={1,2,0,2,2,1,0,1};
while (scanf("%d",&n)!=-1)
{
if (f[n%8]==0)
printf("yes\n");
else
printf("no\n");
}
}
ps:水題啊水題嘛。
posted on 2012-02-29 17:13 wangs 閱讀(269) 評論(0) 編輯 收藏 引用 所屬分類: ACM-201202