Problem Description Determine whether a sequence is a Geometric progression or not. In mathematics, a **geometric progression**, also known , , , , ... . Similarly , , /. Examples of a geometric sequence are powers rk of a fixed number r, such as 2k…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5429 题意:给一段长度不超过100的每个数字(可以是浮点数)的长度不超过1000的序列,问这个序列是否是一个等比数列: 等比数列以第一个数为首项,并且r != 0,一个坑点 之前我写的hdu1002的高精度在这里不能用的,因为我的高精度里面还只能是正整数,这时直接使用java的BigDecimal即可: ps:特别要注意 1 0这个序列不是等比序列!还有 大数比较是否相等,要使用函数,不能使用==,…
题意:给出一个大数数列,问是不是等比数列. 解法:拿java大数搞,注意全是0的情况也是Yes.我把公比用分数表示了,灰常麻烦,题解说只要判a[i - 1] * a[i + 1] == a[i] * a[i]就可以了,涨姿势了. 代码: import java.math.*; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner cin = new Scanne…
Geometric Progression Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://bestcoder.hdu.edu.cn/contests/contest_chineseproblem.php?cid=628&pid=1001 Description 判断一个数列是否为等比数列. 在数学中,等比数列,是一个数列,这个数列中的第一项之后的每一项是前一项乘上一个固定的非零实数(我们称之为公比).比如,数列 2, 6, 18, 54,…
题目代号:HDU 1134 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1134 Game of Connections Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4668    Accepted Submission(s): 2729 Problem Description Thi…
注意题目中的这句话he put the strawberries on the cake randomly one by one,第一次选择草莓其实有N个可能,以某一个草莓为开头,然后顺序的随机摆放,所以最后的概率为n/m^(n-1),最后通过大数模板搞定该题的化简. C++代码 #include<iostream> #include<cstring> #include<cstdio> #include<iomanip> #include<algori…
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3324 http://blog.csdn.net/xymscau/article/details/6776182 #include<cstdio> #include<cstring> #include<string> #include<queue> #include<iostream> #include<algorit…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1042 在网上找了个大数模板方便以后用得到. #include<iostream> #include<string.h> #include<iomanip> #include <stdio.h> #include<algorithm> using namespace std; #define MAXN 9999 //每组的上限值 #define MAX…
题意:小数大数加法 思路:大数模板 #include<iostream> #include<stdio.h> #include<string.h> using namespace std; void plu(char *a,char *b){//注意存储方式:整数倒着存,小数正着存,看代码需注意 int i,j,k,lena,lenb,lena1,lena2,lenb1,lenb2,lenc1,lenc2;//len分别对应相应数组的长度 ],a2[],b1[],b2[…
上次BC遇到一个大数题目,没有大数模板和不会使用JAVA的同学们GG了,赛后从队友哪里骗出大数模板.2333333,真的炒鸡nice(就是有点长),贴出来分享一下好辣. //可以处理字符串前导零 #include <iostream> #include <queue> #include <cstdio> #include <cstring> #include <cstdlib> #include <stack> using names…