BUPT2017 wintertraining(16) #5 A
HDU - 1021

题意

There are another kind of Fibonacci numbers: F(0) = 7, F(1) = 11, F(n) = F(n-1) + F(n-2) (n>=2). 输入n,若F(n)能被3整除,输出yes,否则no

题解

列一下前几项F(i)可以发现n%4==2则是yes,否则no.

代码

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
	int n;
	while(~scanf("%d",&n)){
		if(n%4==2)puts("yes");
		else puts("no");
	}
	return 0;
}

相关文章:

  • 2021-09-29
  • 2021-07-16
  • 2022-12-23
  • 2022-12-23
  • 2022-03-07
  • 2022-02-17
  • 2022-12-23
猜你喜欢
  • 2021-06-29
  • 2021-07-07
  • 2022-01-04
  • 2021-07-20
相关资源
相似解决方案