题目 //BigInteger 和 BigDecimal 是在java.math包中已有的类,前者表示整数,后者表示浮点数 import java.io.*; import java.util.*; import java.math.*; public class Main { /** * @xqq */ public BigInteger an(BigInteger a, BigInteger b, int n) { if(n == 1) { return a; } for(int i = 2…
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=1316 How Many Fibs? Description Recall the definition of the Fibonacci numbers: $f_1 := 1$ $f_2 := 2$ $f_n := f_{n-1} + f_{n-2} \ \ (3 \leq n)$ Given two numbers a and b, calculate how many Fibonacci num…
题目 /** * compareTo:根据该数值是小于.等于.或大于 val 返回 -1.0 或 1: public int compareTo(BigInteger val) 将此 BigInteger 与指定的 BigInteger 进行比较. 对于针对六个布尔比较运算符 (<, ==, >, >=, !=, <=) 中的每一个运算符的各个方法,优先提供此方法. 执行这些比较的建议语句是:(x.compareTo(y) <op> 0), 其中 <op>…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4627 题目大意:给定一个整数n(2 <= n <= 109),满足a+b=n并且[a,b]的最小公倍数最大. 分析:相当简单的的一道题,因为生病好久没做题目,杭电居然是要用__int64,用long long反而错误,为此,WA了无数遍 代码如下: # include<iostream> # include<cstdio> # include<cmath> us…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2114 自己对数论一窍不通啊现在,做了一道水题,贴出来吧...主要是让自己记住这个公式: 前n项和的立方公式为   : s(n)=(n*(n+1)/2)^2; 前n项和的平方公式为:s(n)=n*(n+1)(2*n+1)/6; 代码: #include<iostream> #include<cstdlib> #include<cstdio> using namespace s…
Number Sequence Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 39408    Accepted Submission(s): 16269 Problem Description Given two sequences of numbers : a[1], a[2], ...... , a[N], and b[1],…
//  大数继续 Problem Description Recall the definition of the Fibonacci numbers:  f1 := 1  f2 := 2  fn := fn-1 + fn-2 (n >= 3)  Given two numbers a and b, calculate how many Fibonacci numbers are in the range [a, b].    Input The input contains several t…
题目;http://acm.hdu.edu.cn/showproblem.php?pid=5455 题意就是找出所给字符串有多少个满足题目所给条件的子串,重复的也算,坑点是如果有c,f以外的字符也是不满足条件的,还有我被坑了的地方就是当输入很多f的时候,我尽然脑抽的 认为这是不满足条件的,注意这两点就行了,直接暴力 #include<cstdio> #include<cstring> using namespace std; int main() { int t,i,j,x,y,k…
Rotation Lock Puzzle Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 290    Accepted Submission(s): 60 Problem Description Alice was felling into a cave. She found a strange door with a number s…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1253 题目大意:在所给的时间能顺利离开城堡. #include <iostream> #include <cstdio> #include <queue> #include <cstring> using namespace std; ][][],visit[][][],a,b,c,T; ][]= {,,,,,-,,,,,-,,,,,-,,}; struct n…