HDU 4928 Series 2】的更多相关文章

题意: 一个含n个数的序列a,每两个相邻的数相减得到一个新数,这些数组成一个新的序列. 假设全部得到的序列都满足非严格的单调性.则原序列为nice series.假设给出的序列 本来不满足单调性.它是ugly series.否则输出k,表示前k个序列都满足单调性,第k+1不满足. 算法: 模拟合并和推断单调性,假设不优化会Tle. 假设去掉前导0和后导0,由于0-0还是0,省去一部分操作. 可是为了避免得到的下一个序列的推断有误,应该前后各留一个0. 比方: 7 1 1 1 3 5 7 9 第一…
有了题解以后这题就成了一个模拟题.不过写了好久才把它写对…… Sad #include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #include <cmath> #include <algorithm> #include <string> #include <queue> #include <stack>…
HDU 4927 Series 1 题目链接 题意:给定一个序列,要求不断求差值序列.直到剩一个,输出这个数字 思路:因为有高精度一步.所以要推理一下公式,事实上纸上模拟一下非常easy推出公式就是一个类似杨辉三角的组合数求和,只是奇数位置是加,偶数位置是减,然后高精度过掉 代码: 本人的第一个JAVA程序^ ^ import java.util.Scanner; import java.math.BigInteger; public class Main { public static voi…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4927 解题报告:对于n,结果如下: C(0,n-1) *A[n] - C(1,n-1) * A[n-1] + C(2,n-1) * A[n-2] - C(3,n-1) * A[n-3] ....... C(n-1,n-1) * A[1]; n <= 3000,到了后面二项式会很大,因为要用到高精度的乘法和除法,所以直接用java的大数类写了,简单多了. import java.math.BigInt…
pid=4927">Series 1 大意: 题意不好翻译,英文看懂也不是非常麻烦,就不翻译了. Problem Description Let A be an integral series {A1, A2, . . . , An}. The zero-order series of A is A itself. The first-order series of A is {B1, B2, . . . , Bn-1},where Bi = Ai+1 - Ai. The ith-orde…
题目链接 题意 : n个数,每操作一次就变成n-1个数,最后变成一个数,输出这个数,操作是指后一个数减前一个数得到的数写下来. 思路 : 找出几个数,算得时候先不要算出来,用式子代替,例如: 1 2 3 4 5 6 (2-1) (3-2) (4-3) (5-4)(6-5) (3-2-2+1)(4-3-3+2)(5-4-4+3)(6-5-5+4) (4-3-3+2-3+2+2-1)(5-4-4+3-4+3+3-2)(6-5-5+4-5+4+4-3) (5-4-4+3-4+3+3-2-4+3+3-2…
这场有点难,QAQ.补了好久(。• ︿•̀。) ,总算能写题解了(つд⊂) A. Beautiful numbers CodeForces - 55D 题意 ​ 求\([l,r](1\le l_i\le r_i\le 9\cdot 10^{18})\)的中的 可以被自己每一位上的数字整除的数 的个数. 题解: ​ 知识:如果m%a=0,则任意x, x%a = (x%m)%a. ​ 2520是2~9的lcm.因此任何时候都有2520%pre_lcm==0. ​ 因为2520%pre_lcm==0,…
BUPT2017 wintertraining(15) #5I 题意 输出序列A[1..n]的第n-1阶差分(一个整数). 题解 观察可知答案就是 \[ \sum_{i=0}^{n-1} {(-1)^{i}C_n^{i} A_{n-i}} \] 需要用大整数. 代码 Java代码 import java.io.*; import java.math.*; import java.util.*; import java.text.*; public class Main{ public stati…
Tree Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 102400/102400 K (Java/Others) Total Submission(s): 1643    Accepted Submission(s): 461 Problem Description   Zero and One are good friends who always have fun with each other. This time, t…
Counting Squares Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 1885    Accepted Submission(s): 946 Problem Description Your input is a series of rectangles, one per line. Each rectangle is sp…
1.POJ 1733 Parity game Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 5744   Accepted: 2233 Description Now and then you play the following game with your friend. Your friend writes down a sequence consisting of zeroes and ones. You cho…
Asteroids! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3159    Accepted Submission(s): 2106 Problem Description You're in space.You want to get home.There are asteroids.You don't want to hit…
K-th Number Time Limit: 20000MS   Memory Limit: 65536K Total Submissions: 50247   Accepted: 17101 Case Time Limit: 2000MS Description You are working for Macrohard company in data structures department. After failing your previous task about key inse…
Eight Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 30176   Accepted: 13119   Special Judge Description The 15-puzzle has been around for over 100 years; even if you don't know it by that name, you've seen it. It is constructed with 15…
Prime Ring Problem Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 42600    Accepted Submission(s): 18885 Problem Description A ring is compose of n circles as shown in diagram. Put natural num…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4816 Problem Description The Bathysphere is a spherical deep-sea submersible which was unpowered and lowered into the ocean on a cable, and was used to conduct a series of dives under the sea. The Bathys…
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=4027 Can you answer these queries? Description Problem Description A lot of battleships of evil are arranged in a line before the battle. Our commander decides to use our secret weapon to eliminate the b…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3157 You’ve just built a circuit board for your new robot, and now you need to power it. Your robot circuit consists of a number of electrical components that each require a certain amount of current to…
Tree Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=4757 Description Zero and One are good friends who always have fun with each other. This time, they decide to do something on a tree which is a kind of graph…
http://acm.hdu.edu.cn/showproblem.php?pid=3038 How Many Answers Are Wrong Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3648 Accepted Submission(s): 1401 Problem Description TT and FF are ... fri…
http://acm.hdu.edu.cn/showproblem.php?pid=1043 http://poj.org/problem?id=1077 Eight Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 9173    Accepted Submission(s): 2473 Special Judge Problem D…
下面内容摘自维基百科: 五边形数定理[编辑] 五边形数定理是一个由欧拉发现的数学定理,描写叙述欧拉函数展开式的特性[1] [2].欧拉函数的展开式例如以下: 亦即 欧拉函数展开后,有些次方项被消去,仅仅留下次方项为1, 2, 5, 7, 12, ...的项次,留下来的次方恰为广义五边形数. 当中符号为- - + + - - + + ..... 若将上式视为幂级数,其收敛半径为1,只是若仅仅是当作形式幂级数(formal power series)来考虑,就不会考虑其收敛半径. 和切割函数的关系…
http://acm.hdu.edu.cn/showproblem.php?pid=4927 同学用java写的大整数相减 Series 1 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 295    Accepted Submission(s): 100 Problem Description Let A be an integ…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4930 Fighting the Landlords Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 312    Accepted Submission(s): 100 Problem Description Fighting the…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1016 Prime Ring Problem Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Problem Description A ring is compose of n circles as shown in diagram. Put natural number 1, 2…
Problem Description A ring is compose of n circles as shown in diagram. Put natural number 1, 2, ..., n into each circle separately, and the sum of numbers in two adjacent circles should be a prime. Note: the number of first circle should always be 1…
Bombing From:HDU, 4022 Submit Time Limit: 4000/2000 MS (Java/Others)      Memory Limit: 65768/65768 K (Java/Others) Problem Description It's a cruel war which killed millions of people and ruined series of cities. In order to stop it, let's bomb the…
主题链接:http://acm.hdu.edu.cn/showproblem.php?pid=3103 Problem Description The tiny country of Waterlogged is protected by a series of levees that form a quadrilateral as shown below: The quadrilateral is defined by four vertices. The levees partition t…
Uniform Generator Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 29336    Accepted Submission(s): 11694 Problem Description Computer simulations often require random numbers. One way to generat…
Mathematician QSC Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 229    Accepted Submission(s): 114 Problem Description QSC dream of becoming a mathematician, he believes that everything in t…