
数学
文章平均质量分 72
小小小小葱
这个作者很懒,什么都没留下…
展开
-
hdu4497 GCD and LCM
GCD and LCM Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 1460 Accepted Submission(s): 653Problem DescriptionGiven two positive原创 2015-07-10 17:30:49 · 461 阅读 · 0 评论 -
uva10312 - Expression Bracketing 括号划分
Problem AExpression BracketingInput: standard inputOutput: standard outputTime Limit: 1 secondMemory Limit: 32 MB Inthis problem you will have to find in how many waysn letters can be原创 2014-06-19 17:18:54 · 694 阅读 · 0 评论 -
uva11645 - Bits 统计 巧妙的大数
Problem JBits Input: Standard InputOutput: StandardOutput A bit is a binary digit,taking a logical value of either "1" or "0" (also referredto as "true" or "false" respectively). And every原创 2014-06-18 21:11:26 · 586 阅读 · 0 评论 -
uva1350 - Pinary 第N个满足条件的二进制数
``Pinary" number is a positive number using only two digits ``0" and ``1" with usual rule that it must not begin with a 0, and the additional rule that two successive digits must not be both ``1". Thi原创 2014-06-18 19:05:40 · 607 阅读 · 0 评论 -
uva1386 - Cellular Automaton 循环矩阵
A cellular automaton is a collection of cells on a grid of specified shape that evolves through a number of discrete time steps according to a set of rules that describe the new state of a cell based原创 2014-07-09 17:35:53 · 633 阅读 · 0 评论 -
uva11149 - Power of Matrix 矩阵倍增
Consider an n-by-n matrixA. We define Ak = A *A * ... * A (k times). Here, * denotes the usual matrix multiplication.You are to write a program that computes the matrix A + A2 + A3 + ... + Ak.原创 2014-07-31 09:46:59 · 648 阅读 · 0 评论 -
uva10883 - Supermean 杨辉三角
Do you know how to compute the mean (or average) of n numbers?Well, that's not good enough for me. I want the supermean! "What's asupermean," you ask? I'll tell you. List then given numbers innon-原创 2014-06-17 17:16:11 · 513 阅读 · 0 评论 -
uva1426 - Discrete Square Roots 模线性方程
A square root of a number x is a number r such that r2 = x. A discrete square root of a non-negative integerx is a non-negative integer r such that r2 x mod N , 0r <N , where N is a specific原创 2014-07-03 14:28:49 · 523 阅读 · 0 评论 -
uva1431 - Cryptography Reloaded 大数
What do researchers working at ICPC (Institute for Cryptographic Programming and Computing) do for fun? Well, as you probably have expected, in addition to solving algorithm-related problems on online原创 2014-07-03 10:14:11 · 616 阅读 · 0 评论 -
uva11768 - Lattice Point or Not 扩展gcd
Now a days a very common problem is:“The coordinate of two points in Cartesian coordinate system is (200, 300) and(4000, 5000). If these two points are connected we get a line segment. How manylattice原创 2014-07-02 17:26:38 · 489 阅读 · 0 评论 -
uva1393 - Highways
Hackerland is a happy democratic country with m×n cities, arranged in a rectangularm by n grid and connected bym roads in the east-west direction and n roads in the north-south direction. By pub原创 2014-06-20 17:03:24 · 523 阅读 · 0 评论 -
uva1436 - Counting heaps 统计树的个数
We are given a rooted tree of n vertices. The vertices are to be labeled with numbers1, 2,..., n so that each label is unique and the heap condition holds, i.e. the label of any vertex is less than原创 2014-06-22 16:50:38 · 603 阅读 · 0 评论 -
poj1284 Primitive Roots 原根个数
DescriptionWe say that integer x, 0 i mod p) | 1 <= i <= p-1 } is equal to { 1, ..., p-1 }. For example, the consecutive powers of 3 modulo 7 are 3, 2, 6, 4, 5, 1, and thus 3 is a primitive root m原创 2014-06-22 22:32:42 · 774 阅读 · 0 评论 -
两个向量的夹角(顺时针)
double getRotateAngle(double x1, double y1, double x2, double y2){ const double epsilon = 1.0e-6; const double nyPI = acos(-1.0); double dist, dot, degree, angle; // normalize dist转载 2015-04-13 19:09:04 · 6025 阅读 · 1 评论 -
hdu5015 233 Matrix 西安网络赛I题 构造矩阵
233 MatrixTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 409 Accepted Submission(s): 273Problem DescriptionIn our daily life we原创 2014-09-15 20:43:39 · 550 阅读 · 0 评论 -
uva1356 - Bridge 自适应simpson公式
A suspension bridge suspends the roadway from huge main cables, which extend from one end of the bridge to the other. These cables rest on top of high towers and are secured at each end by anchorages.原创 2014-08-10 14:28:15 · 683 阅读 · 0 评论 -
uva11255 - Necklace 项链旋转翻转 置换
Problem C - NecklaceOnce upon a time, three girls - Winnie, Grace and Bonnie - owned a large number of pearls. However, each of them only had a single color of pearls. Winnie had white pearls, G原创 2014-08-10 14:05:39 · 661 阅读 · 0 评论 -
uva10601 - Cubes 正方体置换
Problem BCubes You are given 12 rods of equal length. Each of them is coloredin certain color. Your task is to determine in how many different ways one canconstruct a cube using these rods a原创 2014-08-08 18:56:04 · 985 阅读 · 0 评论 -
uva12103 - Leonardo's Notebook 置换A^2=B
I just bought Leonardo's secret notebook! Rare objectcollector Stan Ucker was really agitated but his friend,special investigator Sarah Keptic was unimpressed.| How do you know it is genui原创 2014-08-08 18:42:17 · 450 阅读 · 0 评论 -
uva11605 - Lights inside a 3d Grid 概率
Problem ALights inside a 3D GridInput: Standard InputOutput: Standard Output You are given a 3Dgrid, which have dimensions N, M andP. Each of the M xN x P cells has a light. Initially all原创 2014-08-06 11:08:11 · 604 阅读 · 0 评论 -
矩阵快速幂
之前只做了快速幂取模,这次是矩阵。 就因为线代没怎么学,今天还花了一些时间去想为什么矩阵A^k+A^l=A^(k+l),是因为A^n=A^(n-1)*A=A^(n-2)*A*A=.....由于矩阵相乘满足结合律(可以以三个为例证明一下),所以可以任意取位置先后结合,所以有A^k+A^l=A^(k+l)。 两个矩阵相乘,复杂度是O(N^3),再乘M次,所以一个矩阵的M次方时间复杂度是O(原创 2013-12-17 22:53:05 · 700 阅读 · 0 评论 -
hdu3892 Common Roots 最大取模公因式
We have many polynomials modulo p (p is a prime number). An interesting issue would be to determine whether they have some roots in common. Notice roots we mention here are integers in modulo p system原创 2014-06-30 19:41:58 · 659 阅读 · 0 评论 -
uva1415 - Gauss Prime 高斯素数
In the late 1700s', Gauss, a famous mathematician, found a special kind ofnumbers. These integers are all in the form:a + b.The sum and multiplicationofthese integers can be naturally defined as the原创 2014-07-01 14:02:57 · 1970 阅读 · 4 评论 -
uva11916 - Emoogle Grid 网格涂色
Emoogle Grid You have to color an M x N (1M,N108) two dimensional grid. You will be providedK (2K108) different colors to do so. You will also be provided a list of B (0B500)list原创 2014-06-29 21:58:45 · 768 阅读 · 0 评论 -
uva10994 - Simple Addition
Problem ESimple AdditionInput: Standard InputOutput: Standard Output Let’s define a simple recursivefunction F (n), where Let’s define another function S (p,q), In this problem原创 2014-01-14 12:08:47 · 751 阅读 · 0 评论 -
uva306 - Cipher 置换群
Cipher Bob and Alice started to use a brand-new encoding scheme. Surprisingly it is not a Public Key Cryptosystem, but their encoding and decoding is based on secret keys. They chose the原创 2014-01-14 12:19:13 · 1156 阅读 · 0 评论 -
uva10900 - So you want to be a 2n-aire? 概率 递推
Problem A: So you want to be a 2n-aire?The player starts with a prize of $1, and is asked a sequence of n questions. For each question, he mayquit and keep his prize. answer the question. If wro原创 2013-12-12 11:54:56 · 623 阅读 · 0 评论 -
uva557 - Burger 概率递推
Burger When Mr. and Mrs. Clinton's twin sons Ben and Bill had their tenth birthday, the party was held at the McDonald's restaurant at South Broadway 202, New York. There were 20 kids at原创 2013-12-03 22:26:01 · 891 阅读 · 0 评论 -
uva11181 - Probability|Given 条件概率
Problem GProbability|GivenInput: Standard InputOutput: Standard Output N friends go to the local super market together. The probability of their buying something from the market is respecti原创 2013-12-03 10:03:37 · 832 阅读 · 0 评论 -
Ferrers图像
Ferrers图像图像概念一个从上而下的n层格子,mi 为第i层的格子数,当mi>=mi+1(i=1,2,,n-1) ,即上层的格子数不少于下层的格子数时,称之为Ferrers图像。[1]图像性质(1)每一层至少有一个格子; (2)第一行与第一列互换,第二行与第二列互换,…,所得到的图象仍然是Ferrers图象,这两个 Ferrers图象称为是一对共轭的Ferrers图象。转载 2013-11-13 21:05:16 · 1450 阅读 · 0 评论 -
佩尔方程
佩尔方程若一个丢番图方程具有以下的形式:且为正整数,则称此二元二次不定方程为佩尔方程(英文:Pell's equation 德文:Pellsche Gleichung)若是完全平方数,则这个方程式只有解(实际上对任意的,都是解)。对于其余情况,拉格朗日证明了佩尔方程总有解。而这些解可由的连分数求出。佩尔方程的解设 是的连分数表示:的渐近分数列,由连分数理转载 2013-11-13 21:01:23 · 2453 阅读 · 0 评论 -
uva10820 - Send a Table 欧拉函数
Problem ASend a TableInput: Standard InputOutput: Standard Output When participating inprogramming contests, you sometimes face the following problem: You know how tocalcutale the output for原创 2013-11-23 10:28:19 · 650 阅读 · 0 评论 -
uva106 - Fermat vs. Pythagoras 互素勾股数
Fermat vs. Pythagoras BackgroundComputer generated and assisted proofs and verification occupy a small niche in the realm of Computer Science. The first proof of the four-color probl原创 2013-11-22 11:35:26 · 1926 阅读 · 0 评论 -
快速幂取模
前几天做一个题都快做出来了,结果就是不会快速算幂导致超时。。 快速幂取模我看了2种方法。 首先有公式: (a+b)%m=(a%m+b%m)%m (a*b)%m=(a%m*b%m)%m 1.算法导论里的,算a^b mod n,设b[k]是b二进制的最高位(不算符号位)。Modular-Exponentiation(a, b, n) 1.原创 2013-08-02 15:52:49 · 519 阅读 · 0 评论 -
uva11029 - Leading and Trailing n^k保留前三位
Problem CLeading and TrailingTime limit: 2 seconds Apart from the novice programmers, all others know that you can’t exactly represent numbers raised to some high power.原创 2013-11-24 21:31:07 · 800 阅读 · 0 评论 -
线性筛素数 线性筛欧拉函数
线性筛素数的思想:原创 2014-05-02 16:14:41 · 670 阅读 · 0 评论 -
uva11754 - Code Feat 枚举 中国剩余定理
Hooray! Agent Bauer has shot the terrorists, blown upthe bad guy base, saved the hostages, exposed the moles in the government,prevented an environmental catastrophe, and found homes for three orphan原创 2014-06-29 19:56:25 · 503 阅读 · 0 评论 -
uva10692 - Huge Mods poj2164: Remainder Calculator 指数循环节
Problem XHuge ModInput: standard inputOutput: standard outputTime Limit: 1 secondThe operator for exponentiation is different from the addition, subtraction, multiplication or division ope原创 2014-06-27 20:54:10 · 759 阅读 · 0 评论 -
uva10673 - Play with Floor and Ceil 扩展欧几里德算法
Problem APlay with Floor and CeilInput: standard inputOutput: standard outputTime Limit: 1 second TheoremFor any two integers x and k there exists two more integersp and q such that:原创 2013-11-25 12:46:59 · 857 阅读 · 0 评论 -
uva10828 - Back to Kernighan-Ritchie 约旦高斯消元
Problem IBack to Kernighan-RitchieInput: Standard InputOutput: Standard Output Youmust have heard the name of Kernighan and Ritchie, the authors ofThe C Programming Language. While cod原创 2014-07-10 19:18:26 · 493 阅读 · 0 评论