HDU-1021 Fibonacci Again
2016-07-18 14:12
375 查看
2016-07-16晚
题目大意:F(0) = 7, F(1) = 11, F(n) = F(n-1) + F(n-2) (n>=2),问 F(n) (n < 1,000,000) 是否能被 3 整除。
解题思路:找规律,从 2 开始,每 4 个能被3整除。
HDU-1021 Fibonacci Again
题目大意:F(0) = 7, F(1) = 11, F(n) = F(n-1) + F(n-2) (n>=2),问 F(n) (n < 1,000,000) 是否能被 3 整除。解题思路:找规律,从 2 开始,每 4 个能被3整除。
#include <iostream> using namespace std; int main() { int n; while ( cin >> n ) { if ( (n-2) % 4 == 0 ) cout << "yes" << endl; else cout << "no" << endl; } return 0; }
相关文章推荐
- HDU 1839 Delay Constrained Maximum Capacity Path(最短路+二分)
- Ubuntu 14中,Foxmail关联163邮箱账号时,总提示“密码错误”的解决方案
- Ain_EditPlus配置安装教程
- mac下Genymotion添加虚拟设备提示 The file is corrupt. Do you want to download the file again?解决方法
- 算法实战(三)--求K-Pairs
- main函数的两个参数
- Greenplum failed segment的恢复方法
- 从零开始,5分钟创建并玩转属于自己的区块链(图文攻略)
- 真机测试遇到 ——is not paired with your computer
- git时认证失败(Authentication failed )的解决
- 安装Ubutun 12.04 遇到the grub-efi-amd64-signed package failed to install into...【解决办法】
- 最新中国菜刀caidao-20160620下载和说明
- 【poj3691-DNA repair】AC自动机+DP
- ubuntu enable all Ubuntu software (main universe restricted multiverse) repositories use
- 8A - Train and Peter
- the user operation is waiting
- Gradle sync failed: Cause: org/gradle/api/publication/maven/internal/DefaultMavenFactory
- 树形DP+DFS序+树状数组 HDOJ 5293 Tree chain problem(树链问题)
- HDU - 1021 Fibonacci Again
- 树链剖分+线段树 HDOJ 5029 Relief grain(分配粮食)