poj 1517 u Calculate e(精度控制+水题)】的更多相关文章

一.Description A simple mathematical formula for e is e=Σ0<=i<=n1/i! where n is allowed to go to infinity. This can actually yield very accurate approximations of e using relatively small values of n. Input No input Output Output the approximations o…
一.Description It is said that 90% of frosh expect to be above average in their class. You are to provide a reality check. Input The first line of standard input contains an integer C, the number of test cases. C data sets follow. Each data set begins…
1.链接地址: http://bailian.openjudge.cn/practice/1517 http://poj.org/problem?id=1517 2.题目: 总时间限制: 1000ms 内存限制: 65536kB 描述 A simple mathematical formula for e is e=Σ0<=i<=n1/i!where n is allowed to go to infinity. This can actually yield very accurate ap…
u Calculate e Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 19465   Accepted: 11362   Special Judge Description A simple mathematical formula for e is e=Σ0<=i<=n1/i!where n is allowed to go to infinity. This can actually yield very ac…
题目链接:http://poj.org/problem?id=3254 Time Limit: 2000MS Memory Limit: 65536K Description Farmer John has purchased a lush new rectangular pasture composed of M by N (1 ≤ M ≤ 12; 1 ≤ N ≤ 12) square parcels. He wants to grow some yummy corn for the cows…
题意:给定 n 个炸弹的坐标和爆炸时间,问你能不能逃出去.如果能输出最短时间. 析:其实这个题并不难,只是当时没读懂,后来读懂后,很容易就AC了. 主要思路是这样的,先标记所有的炸弹的位置,和时间,在数组中标记就好,只要赋值给它的爆炸时间就好,注意如果有多个,要赋值最小的那个, 然后用BFS走就行了. 代码如下: #include <cstdio> #include <string> #include <cstdlib> #include <cmath> #…
Description There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of four adjacent tiles. But he can't move on red tiles, he can move only…
以下是poj百道水题,新手可以考虑从这里刷起 搜索1002 Fire Net1004 Anagrams by Stack1005 Jugs1008 Gnome Tetravex1091 Knight Moves1101 Gamblers1204 Additive equations 1221 Risk1230 Legendary Pokemon1249 Pushing Boxes 1364 Machine Schedule1368 BOAT1406 Jungle Roads1411 Annive…
    A+B Problem Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 311263   Accepted: 171333 Description Calculate a+b Input Two integer a,b (0<=a,b<=10) Output Output a+b   Sample Input 1 2 Sample Output 3 计算两个整数的和 解决思路 这是经典水题了,每个OJ必有的.题目…
Financial Management Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 126087   Accepted: 55836 Description Larry graduated this year and finally has a job. He's making a lot of money, but somehow never seems to have enough. Larry has deci…
u Calculate e Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 28686    Accepted Submission(s): 12762 Problem Description A simple mathematical formula for e is where n is allowed to go to infini…
POJ 1488 题目大意:给定一篇文章,将它的左引号转成 ``(1的左边),右引号转成 ''(两个 ' ) 解题思路:水题,设置一个bool变量标记是左引号还是右引号即可 /* POJ 1488 Tex Quotes --- 水题 */ #include <cstdio> #include <cstring> int main() { #ifdef _LOCAL freopen("D:\\input.txt", "r", stdin); #…
POJ 3176 Cow Bowling 链接: http://poj.org/problem?id=3176 这道题可以算是dp入门吧.可以用一个二维数组从下向上来搜索从而得到最大值. 优化之后可以直接用一维数组来存.(PS 用一维的时候要好好想想具体应该怎么存,还是有技巧的) #include<iostream> #include<cstring> #include<cmath> #include<cstdio> using namespace std;…
题目:http://poj.org/problem?id=3080 水题,暴搜 #include <iostream> #include<cstdio> #include<cstring> #include<cstdlib> #include<stack> #include<queue> #include<iomanip> #include<cmath> #include<map> #include…
1.有哪些数据类型? 2.数据类型在不同的编译器会有不同的位宽,如何得知? 使用如下命令: cout<<sizeof(int)<<endl; cout<<sizeof(double)<<endl; 3.如何知道各个数据类型所表达的最大最小值?   #include <limits> //该头文件必须加上 . . . cout<<numeric_limits<int>::max()<<endl; cout<…
一.使用poi解析excel文档 注:全部采用poi接口进行解析,不需要区分xls.xlsx格式,不需要判断文档类型. poi中的日期格式判断仅支持欧美日期习惯,对国内的日期格式并不支持判断,怎么办?所以通过日期格式判断是极其重要的手段,因为日期在excel中也是double类型的数值,所以靠类型判断是极不可靠的,但是有几种常用的日期格式(比如:yyyy-mm-dd,yy-mm-dd等)还是可以通过类型进行判断,因为它们的类型在excel中属于保留值,这点很重要,毕竟office文档想要正确显示…
转载请注明出处:優YoU http://blog.csdn.net/lyy289065406/article/details/6642573 部分解题报告添加新内容,除了原有的"大致题意"和"解题思路"外, 新增"Source修正",因为原Source较模糊,这是为了帮助某些狂WA的同学找到测试数据库,但是我不希望大家利用测试数据打表刷题 ­­ ­ 推荐文:1.一位ACMer过来人的心得 2. POJ测试数据合集 OJ上的一些水题(可用来练手和增…
题目链接:http://poj.org/problem?id=3984 Description 定义一个二维数组: int maze[5][5] = { 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, }; 它表示一个迷宫,其中的1表示墙壁,0表示可以走的路,只能横着走或竖着走,不能斜着走,要求编程序找出从左上角到右下角的最短路线. Input 一个5 × 5的二维数组,表示一个迷宫.数据保证有…
POJ.2739 Sum of Consecutive Prime Numbers(水) 代码总览 #include <cstdio> #include <cstring> #include <vector> #include <cmath> #define nmax 10005 using namespace std; int prime[nmax],n; vector<int> vprime; void init() { memset(pri…
 1.在window下的命令重定向输出到文件里 2.将内容输入到某个文件里的方式:命令<1.txt (使用1.txt中的命令) 3.读取文件里的名,然后将命令读取最后输出到文件里.命令<1.txt>2.txt   这一句的作用就是将运行的命令输入到2.txt中. 4.文件重定向案例1 #include <iostream> using namespace std; void main() { char str[30] = { 0 }; cin >> str;…
http://poj.org/problem?id=3461 直接KMP就好.水题 #include<cstdio> #include<cstring> const int MAXN=10000+10; const int MAXM=1000000+10; char P[MAXN],T[MAXM]; int f[MAXN],n,m,ans; void getFail() { f[0]=f[1]=0; for(int i=1;i<n;i++){ int j = f[i]; wh…
1.String.format​(String format,Object… args) Java中用String.format()来控制输出精度, format参数用来设置精度格式, args参数代表待格式化的数字. 返回值是格式化后的字符串. Java API文档中的解释是这样的: 文档不好懂… 没关系 直接上代码! //精确到小数点后两位: public class test { public static void main(String args[]) { //格式控制与C语言类似 S…
DNA Sorting Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 80832   Accepted: 32533 Description One measure of ``unsortedness'' in a sequence is the number of pairs of entries that are out of order with respect to each other. For instanc…
Biorhythms Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 110991   Accepted: 34541 Description Some people believe that there are three cycles in a person's life that start the day he or she is born. These three cycles are the physical,…
487-3279 Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 236746   Accepted: 41288 Description Businesses like to have memorable telephone numbers. One way to make a telephone number memorable is to have it spell a memorable word or phras…
Hangover Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 99450   Accepted: 48213 Description How far can you make a stack of cards overhang a table? If you have one card, you can create a maximum overhang of half a card length. (We're as…
I Think I Need a Houseboat Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 85149   Accepted: 36857 Description Fred Mapper is considering purchasing some land in Louisiana to build his house on. In the process of investigating the land,…
题意:找到一段数字里最大值和最小值的差 水题 #include<cstdio> #include<iostream> #include<algorithm> #include<cstring> #include<cmath> #include<queue> using namespace std; ; const int INF=0x3f3f3f3f; int n,m,t; ; ],dpMIN[MAXN][]; int mm[MAXN…
题意:给定一个金字塔,第 i 行有 i 个数,从最上面走下来,只能相邻的层数,问你最大的和. 析:真是水题,学过DP的都会,就不说了. 代码如下: #include <cstdio> #include <string> #include <cstdlib> #include <cmath> #include <iostream> #include <cstring> #include <set> #include <…
#include <iostream> using namespace std; /*248K 32MS*/ int main() { int s,d; while(cin>>s>>d) { int count=0; for(int i=5;i>0;i--) { if(s*i<(5-i)*d) { count=i; break; } } int total=s*count-d*(5-count); total*=2; if(count>=2) tota…