nyoj 461
来源:互联网 发布:舒同 书法 知乎 编辑:程序博客网 时间:2024/05/21 06:40
题目来源:http://acm.nyist.net/JudgeOnline/problem.php?pid=461
#include <iostream>#include <cstdio>#include <cstring>#include <cmath>using namespace std;//f(n)=n*log10((1+sqrt(5))/2)-log10(sqrt(5))int main(){ int arr[22]; arr[0] = 0, arr[1] = 1; for(int i = 2; i <= 20; ++i) arr[i] = arr[i-1] + arr[i-2]; int n, res, ans2; double ans1, ans3; while(~scanf("%d", &n)) { if(n <= 20) { printf("%d\n", arr[n]); continue ; } ans1 = n*log10(0.5+0.5*sqrt(5))-log10(sqrt(5)); ans2 = (int)ans1; ans1 -= ans2; ans3 = pow(10.0, ans1); res = ans3*1000; printf("%d\n", res); } return 0;}
0 0
- nyoj 461
- NYOJ
- NYOJ
- NYOJ
- NYOJ
- NYOJ
- NYOJ
- NYOJ
- NYOJ
- NYOJ
- NYOJ
- NYOJ
- NYOJ
- NYOJ
- nyoj
- NYOJ
- NYOJ
- NYOJ
- Spring中多配置文件以及寻觅引用其他bean的方式
- HDU 1003 max sum
- Could not resolve archetype org.apache.maven.archetypes:maven-archetype-quickstart:
- Mongodb简介
- Hadoop 权限管理
- nyoj 461
- To the Max-动态规划 树状数组
- 视频主观质量评价工具:MSU Perceptual Video Quality tool
- C#属性与字段
- Python快速入门
- android中ContactsContract类的使用
- ESD对电子设备造成的困扰
- 静态区间第k大数
- thinkphp3.2开发排错一例——当__APP__的值变化后,需要删除缓存~runtime.php文件