UVA_474_Heads / Tails Probability
2016-04-19 11:25
549 查看
#include<iostream> #include<sstream> #include<string> #include<vector> #include<list> #include<set> #include<map> #include<stack> #include<queue> #include<algorithm> #include<bitset> #pragma warning(disable:4996) using std::cin; using std::cout; using std::endl; using std::stringstream; using std::string; using std::vector; using std::list; using std::pair; using std::set; using std::multiset; using std::map; using std::multimap; using std::stack; using std::queue; using std::priority_queue; using std::bitset; int main() { //freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout); vector<pair<double, int>>val_pow(1000001); val_pow[1].first = 5.0; val_pow[1].second = 1; for (int i = 2; i <= 1000000; i++) { val_pow[i].first = val_pow[i - 1].first / 2; val_pow[i].second = val_pow[i - 1].second; if (val_pow[i].first < 1) { val_pow[i].first *= 10.0; val_pow[i].second++; } } int power; while (cin >> power) { printf("2^-%d = %.3lfe-%d\n",power,val_pow[power].first,val_pow[power].second); } return 0; }
相关文章推荐
- 关于AIR新浪登录测试
- Failed to resolve attribute at index 6
- flask框架配置email问题汇总,包括163邮箱,qq邮箱,gmail等国内外邮箱
- 找不到dlopen failed: library "/data/data/com.example.gpstest1/lib/libgnustl_shared.so" not found
- assign、weak、strong、retain、__block、__weak
- TypedArray和obtainStyledAttributes使用
- Win7 SSH Secure connect Ubuntu: server responded algorithm negotiation failed
- BZOJ2434 [Noi2011]阿狸的打字机(AC自动机 + fail树 + DFS序 + 线段树)
- R-CNN笔记2:rcnn_train.m文件
- poj 1995Raising Modulo Numbers
- 模拟器安装apk提示:INSTALL_FAILED_NO_MATCHING_ABIS
- MySQL实现批量检查表并进行repair与optimize的方法
- Linux 上使用 Gmail SMTP 服务器发送邮件通知
- FOJ 2216 The Longest Straight 第六届福建省大学生程序设计竞赛 E 尺取法乱搞
- 人工智能概述
- shrio 权限管理filterChainDefinitions过滤器配置
- 服务器中很多的CLOSE_WAIT
- 自定义控件三部曲之绘图篇(八)——Paint之ColorMatrix与滤镜效果
- URAL 2060 Subpalindrome Pairs Manacher
- 人工智能60年:纪念活动宣传什么?