随笔分类 - ACM---数学、思维
摘要:Problem Description 度熊手上有一本字典存储了大量的单词,有一次,他把所有单词组成了一个很长很长的字符串。现在麻烦来了,他忘记了原来的字符串都是什么,神奇的是他竟然记得原来那些字符串的哈希值。一个字符串的哈希值,由以下公式计算得到: H(s)=∏i≤len(s)i=1(Si−28)
阅读全文
摘要:Description The SUM problem can be formulated as follows: given four lists A, B, C, D of integer values, compute how many quadruplet (a, b, c, d ) ∈ A
阅读全文
摘要:Description Simon is doing a physics experiment with N identical balls with the same radius of R centimeters. Before the experiment, all N balls are f
阅读全文
摘要:Description Jessica's a very lovely girl wooed by lots of boys. Recently she has a problem. The final exam is coming, yet she has spent little time on
阅读全文
摘要:Problem Description ztr loves research Math.One day,He thought about the "Lower Edition" of triangle equation set.Such as n=x2−y2. He wanted to know t
阅读全文
摘要:题意 给你四个木棍的长度,问你这四根木棍能不能组成一个四边形。 思路 四边形成立的条件比较简单,就是任意三边之和大于第四边。 但是这道题目有两个坑。 一是输入的四条边中可能会出现长度为0的边。 二是四个数据都比较大,直接加减都容易爆long long。我的解决方案是使用unsighed long l
阅读全文
摘要:我们考虑集合中的每个数x对答案的贡献。 设集合有n个数,则包含x的子集个数有2^(n-1)个。 那么当n > 1时,x出现了偶数次,所以其对答案的贡献就是0;当 n = 1时,其对答案的贡献是 x。 AC代码: 1 #pragma comment(linker, "/STACK:1024000000
阅读全文
摘要:Problem Description Long long ago, there were n adorkable GT. Divided into two groups, they were playing games together, forming a column. The i−th GT
阅读全文
摘要:来自官方题解: AC代码: 1 #pragma comment(linker, "/STACK:1024000000,1024000000") 2 #include<iostream> 3 #include<cstdio> 4 #include<cstring> 5 #include<cmath>
阅读全文
摘要:Problem Description Clarke is a patient with multiple personality disorder. One day he turned into a learner of geometric. He did a research on a inte
阅读全文
摘要:Problem Description Clarke is a patient with multiple personality disorder. One day he turned into a learner of graph theory. He learned some algorith
阅读全文
摘要:题解: 在圆上点三个点时,除圆上三个交点外,圆内没有交点;在圆上点四个点时,除圆上四个交点外,圆内出现了一个交点,因此,在N个点中每四个点便可以在圆内产生一个交点,因此N个点在圆内形成的点的个数为CN4,总的交点数就是CN4+N 1 #pragma comment(linker, "/STACK:1
阅读全文
摘要:Problem Description Our lovely KK has a difficult mathematical problem:he has a N(1≤N≤1018) meters steel,he will cut it into steels as many as possibl
阅读全文
摘要:方法一:由十字相乘相关理论我们能知道,如果要有p,k,q,m,那么首先要有解,所以b*b-4*a*c要>0,然而因为p,k,q,m是正整数,所以代表x1,x2都是有理数,有理数是什么鬼呢?就是解不带根号,我们知道有求根公式,其中2*a,-b都保证是自然数了,如果根号下b*b-4*a*c也保证是有理数
阅读全文
摘要:Problem Description There is a point P at coordinate (x,y). A line goes through the point, and intersects with the postive part of X,Y axes at point A
阅读全文
摘要:Problem DescriptionThere are many unsolvable problem in the world.It could be about one or about zero.But this time it is about bigger number. Given a...
阅读全文
摘要:Problem DescriptionA frog has just learned some number theory, and can't wait to show his ability to his girlfriend.Now the frog is sitting on a grid ...
阅读全文
摘要:Problem DescriptionThere is a number N.You should output "YES" if N is a multiple of 2, 3 or 5,otherwise output "NO". InputThere are multiple test cas...
阅读全文
摘要:Problem DescriptionThere are n balls with m colors. The possibility of that the color of the i-th ball is color j is ai,jai,1+ai,2+...+ai,m. If the nu...
阅读全文
摘要:Problem DescriptionThe sky was brushed clean by the wind and the stars were cold in a black sky. What a wonderful night. You observed that, sometimes ...
阅读全文