HUST 1003 Sibonacci Numbers(杂题)
来源:互联网 发布:淘宝组装机店铺大牌 编辑:程序博客网 时间:2024/06/05 08:06
题目链接:http://acm.hust.edu.cn/problem.php?id=1003
As is known to all, the definition of Fibonacci Numbers is:
f(1)=1
f(2)=1
f(n)=f(n-1)+f(n-2) (n>=3)
Now Sempr found another Numbers, he named it "Sibonacci Numbers", the definition is below:
f(x)=0 (x<0)
f(x)=1 (0<=x<1)
f(x)=f(x-1)+f(x-3.14) (x>=1)
求f(n)
结果对1000000007取余数
这个转换成整数,然后注意精度,貌似不需要用long long
#include <stdio.h>#include <string.h>#include <algorithm>#include <iostream>#define eps 1e-8using namespace std;const int maxn = 100010;const int mod = 1000000007;int rec[maxn];int init(){ int i,j,k; for(i=0;i<314;i++) rec[i]=1; for(i=314;i<maxn;i++) rec[i]=(rec[i-100]+rec[i-314])%mod; return 0;}int main(){ int i,j,k,ans,t; double w; init(); scanf("%d",&t); while(t--){ scanf("%lf",&w); if(w<0){ printf("0\n"); continue; } ans=int((w+eps)*100); printf("%d\n",rec[ans]); } return 0;}
0 0
- HUST 1003 Sibonacci Numbers(杂题)
- hust 1003 - Sibonacci Numbers
- 1003 - Sibonacci Numbers
- Hdu 1893 Sibonacci Numbers
- Hust oj 1720 Fibonacci Numbers(水题)
- hust-Integer Numbers
- HUST 1600 Lucky Numbers
- HUST 1600 Lucky Numbers
- Hust oj 1753 Triangular numbers(三角数)
- HUST-1600 - Lucky Numbers 深搜
- Cubic-free numbers II HUST
- HUST Sum of Consecutive Prime Numbers
- HUST 1644 (思维)
- HUST 1017(DLX)
- HUST
- HUST
- HUST
- HUST
- 收集整理的几个iOS阅读应用开发相…
- ios 第三方苹果开发库之ASIHTTPReq…
- Java for Mac OS X Lion
- IOS 小技巧 何时释放release UIBut…
- xcode 4.2 新建工程模板详解 和导…
- HUST 1003 Sibonacci Numbers(杂题)
- openfire + spark + sparkweb + pa…
- MyEclipse 10.0 (Mac)离线下线安装
- Mac OS 上使用的远程桌面工具
- Eclipse 中在线安装反编译插件jode
- 强行触发shouldAutorotateToInterf…
- 强制iphone界面马上旋转
- UITableView Background Image
- iPhone中按Home键退出程序