![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数学
文章平均质量分 76
阿.荣.
勿弃
展开
-
leetcode 1610. 可见点的最大数目 【几何+滑动窗口】
思路:题意是,站在观察点location的位置,在视角angle的范围内,可以看到的最多的点个数,且同一直线遮挡的或者重叠的点可以记为多个。先计算每个点与location的直线与x正轴之间的夹角,并从小到大排序。以每个夹角上的点为视线的起始范围,遍历比它大的角度,寻找能构成最大视角的右边界点。计算夹角可以用math.atan2(y, x), 它的范围为(-pi, pi), 因为视角的范围是360度的环,故给每个角加360度,加入角度列表。code:class Solution: def .原创 2021-12-17 15:20:07 · 227 阅读 · 0 评论 -
leetcode 372. 超级次方【同余定理+递推】
思路:递推公式:class Solution: def superPow(self, a: int, b: List[int]) -> int: mod = 1337 ans = 1 a = a % mod for i in b: ans = pow(ans, 10, mod) * pow(a, i, mod ) % mod return ans...原创 2021-12-06 11:21:00 · 154 阅读 · 0 评论 -
leetcode 400. 第 N 位数字 【数学】
class Solution: def findNthDigit(self, n: int) -> int: """ 统计位数为m的数字的个数,并且乘以m,就等于数字字符串的位数。 """ i = 1 # 整数的位数 cnt = 0 zeros = 0 # 寻找第n位数字可能存在于哪个整数区间 while n > cnt + 9 * pow(10, zero.原创 2021-12-01 00:08:55 · 65 阅读 · 0 评论 -
leetcode 335. 路径交叉【归纳】
给你一个整数数组 distance 。从 X-Y 平面上的点 (0,0) 开始,先向北移动 distance[0] 米,然后向西移动 distance[1] 米,向南移动 distance[2] 米,向东移动 distance[3] 米,持续移动。也就是说,每次移动后你的方位会发生逆时针变化。判断你所经过的路径是否相交。如果相交,返回 true ;否则,返回 false 。示例 1:![在这里插入图片描述](https://img-blog.csdnimg.cn/d2d984afb9924504b原创 2021-10-30 17:39:18 · 183 阅读 · 0 评论 -
leetcode 29. 两数相除【打表+数学】
分析:避免直接进行乘法、除法和mod取余,以及正确处理溢出问题特殊情况:(如何判断的特殊情况的类别?)1.2.3.一般情况:(为什么是全负数而不是全正数?如何进行二分查找的?)先将两个数都处理成负数,二分查找...原创 2021-10-13 09:45:51 · 76 阅读 · 0 评论 -
leetcode 974. 和可被 K 整除的子数组【一维前缀和+Hashmap+同余定理】
给定一个整数数组 A,返回其中元素之和可被 K 整除的(连续、非空)子数组的数目。示例:输入:A = [4,5,0,-2,-3,1], K = 5输出:7解释:有 7 个子数组满足其元素之和可被 K = 5 整除:[4, 5, 0, -2, -3, 1], [5], [5, 0], [5, 0, -2, -3], [0], [0, -2, -3], [-2, -3]提示:1 <= A.length <= 30000-10000 <= A[i] <= 10000原创 2021-08-29 10:38:59 · 106 阅读 · 0 评论 -
light oj 1214 - Large Division (同于定理--整除运算)
1214 - Large Division PDF (English)StatisticsForumTime Limit: 1 second(s)Memory Limit: 32 MBGiven two integers, a and b, you should check whether a is原创 2016-09-16 17:08:49 · 229 阅读 · 0 评论 -
light oj 1216 - Juice in the Glass (几何计算)
1216 - Juice in the Glass PDF (English)StatisticsForumTime Limit: 2 second(s)Memory Limit: 32 MBOnce upon a time, there lived a mad programmer. He lov原创 2016-09-16 18:01:18 · 481 阅读 · 0 评论 -
cdeforces 697 A. Pineapple Incident (数学)
A. Pineapple Incidenttime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputTed has a pineapple. This pineapple is原创 2016-08-25 11:41:23 · 395 阅读 · 0 评论 -
Light OJ 1116 - Ekka Dokka (简单数学)
1116 - Ekka Dokka PDF (English)StatisticsForumTime Limit: 2 second(s)Memory Limit: 32 MBEkka and his friend Dokka decided to buy a cake. They both lov原创 2016-08-13 11:52:01 · 302 阅读 · 0 评论 -
lightoj 1058 - Parallelogram Counting (几何,平行四边形)
1058 - Parallelogram Counting PDF (English)StatisticsForumTime Limit: 2 second(s)Memory Limit: 32 MBThere are n distinct points in the plane, given by原创 2016-08-14 17:55:13 · 322 阅读 · 0 评论 -
light oj 1211 - Intersection of Cubes (立方体的交集的体积)
1211 - Intersection of Cubes PDF (English)StatisticsForumTime Limit: 0.5 second(s)Memory Limit: 32 MBYou are given n cubes, each cube is described by原创 2016-09-16 10:02:46 · 1035 阅读 · 0 评论 -
light oj 1202 - Bishops (规律)
1202 - Bishops PDF (English)StatisticsForumTime Limit: 1 second(s)Memory Limit: 32 MBThere is an Infinite chessboard. Two bishops are there. (Bishop m原创 2016-09-16 09:24:07 · 291 阅读 · 0 评论 -
lightoj 1282 - Leading and Trailing (数学--log使用)
1282 - Leading and Trailing PDF (English)StatisticsForumTime Limit: 2 second(s)Memory Limit: 32 MBYou are given two integers: n and k, your task is to原创 2016-08-23 20:56:40 · 570 阅读 · 0 评论 -
lightoj 1045 - Digits of Factorial (数学-log运用--阶乘进制位数)
1045 - Digits of Factorial PDF (English)StatisticsForumTime Limit: 2 second(s)Memory Limit: 32 MBFactorial of an integer is defined by the following f原创 2016-08-23 20:41:41 · 390 阅读 · 0 评论 -
lightoj 1043 - Triangle Partitioning (数学)
1043 - Triangle Partitioning PDF (English)StatisticsForumTime Limit: 0.5 second(s)Memory Limit: 32 MBSee the picture below.You are given AB, AC an原创 2016-08-23 20:31:11 · 369 阅读 · 0 评论 -
codeforces B. Cells Not Under Attack (数学)
B. Cells Not Under Attacktime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputVasya has the square chessboard o原创 2016-08-23 12:35:50 · 326 阅读 · 0 评论 -
codeforces C. Pythagorean Triples (【数学】毕达哥拉斯三元数组 勾股定理)
C. Pythagorean Triplestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputKatya studies in a fifth grade. Recen原创 2016-08-23 12:19:16 · 1600 阅读 · 0 评论 -
lightoj 1104 - Birthday Paradox (基本数学)
1104 - Birthday Paradox PDF (English)StatisticsForumTime Limit: 2 second(s)Memory Limit: 32 MBSometimes some mathematical results are hard to believe.原创 2016-08-14 18:06:09 · 227 阅读 · 0 评论 -
lightoj 1294 Positive Negative Sign 【规律】
T - TTime Limit:2000MS Memory Limit:32768KB 64bit IO Format:%lld & %lluSubmit StatusDescriptionGiven two integers: n and m and n is divisible by 2m, you have to write down the原创 2016-06-01 19:28:31 · 348 阅读 · 0 评论 -
poj 2719 Faulty Odometer (数学思维)
Faulty OdometerTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 9277 Accepted: 5744DescriptionYou are given a car odometer which displays the miles原创 2017-03-15 17:14:10 · 365 阅读 · 0 评论 -
poj 1365 Prime Land (数学--唯一分解定理)
Prime LandTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 4098 Accepted: 1856DescriptionEverybody in the Prime Land is using a prime base number syste原创 2017-03-28 21:39:20 · 455 阅读 · 0 评论 -
codeforces 785 C. Anton and Fairy Tale (数学 二分搜索)
C. Anton and Fairy Taletime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAnton likes to listen to fairy tales原创 2017-03-21 19:55:05 · 358 阅读 · 0 评论 -
hdoj 5666 Segment ( 数学几何 +快速积)
SegmentTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1756 Accepted Submission(s): 647Problem Description Silen August原创 2017-03-08 18:22:16 · 590 阅读 · 0 评论 -
codeforces 743 C. Vladik and fractions (数学)
C. Vladik and fractionstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputVladik and Chloe decided to determin原创 2016-12-20 18:05:23 · 430 阅读 · 0 评论 -
codeforces 735 D. Taxes (数学)
D. Taxestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMr. Funt now lives in a country with a very specif原创 2016-12-19 18:14:36 · 324 阅读 · 0 评论 -
hdoj 1005 Number Sequence (斐波那契数列 找循环节)
Number SequenceTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 158599 Accepted Submission(s): 38859Problem DescriptionA numbe原创 2016-11-13 18:55:11 · 504 阅读 · 0 评论 -
hdoj 1058 Humble Numbers (*)
Humble NumbersTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 24458 Accepted Submission(s): 10722Problem DescriptionA number原创 2016-11-13 16:11:26 · 335 阅读 · 0 评论 -
hdoj 1568 Fibonacci (斐波那契数列通项公式+取对数)
FibonacciTime Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4901 Accepted Submission(s): 2280Problem Description2007年到来了。经过2006年原创 2016-11-12 22:07:40 · 862 阅读 · 0 评论 -
hdoj 2601 An easy problem (数学)
An easy problemTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 9385 Accepted Submission(s): 2315Problem DescriptionWhen Teddy原创 2016-10-07 15:26:29 · 343 阅读 · 0 评论 -
codeforces 257 C. View Angle (数学)
C. View Angletime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputFlatland has recently introduced a new type o原创 2016-10-23 17:51:43 · 486 阅读 · 0 评论 -
poj 1942 Paths on a Grid (组合&阶乘处理)
Paths on a GridTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 24936 Accepted: 6200DescriptionImagine you are attending your math lesson at school. On原创 2016-10-09 21:05:48 · 326 阅读 · 0 评论 -
zzulioj 1905: 小火山的跳子游戏
1905: 小火山的跳子游戏Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 420 Solved: 83SubmitStatusWeb BoardDescription 小火山和火山火山在一块玩跳子游戏。规则如下: 1:跳子的起始位置为0,棋盘大小从1到N 2:每次跳子跳k步。 例如当前位置为i, 那原创 2016-08-10 19:05:34 · 246 阅读 · 0 评论 -
zzulioj 1913: 小火山的计算能力
1913: 小火山的计算能力Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 442 Solved: 105SubmitStatusWeb BoardDescription别人说小火山的计算能力不行,小火山很生气,于是他想证明自己,现在有一个表达式,他想计算出来。Input首先是一个t(1Ou原创 2016-08-10 19:01:37 · 317 阅读 · 0 评论 -
light oj 1078 - Integer Divisibility (取模运算)
1078 - Integer Divisibility PDF (English)StatisticsForumTime Limit: 2 second(s)Memory Limit: 32 MBIf an integer is not divisible by 2 or 5, some multi原创 2016-09-12 18:53:27 · 272 阅读 · 0 评论 -
(二) E - E && hdoj 无限的路 【规律】
无限的路Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 8065 Accepted Submission(s): 4186Problem Description甜甜从小就喜欢画图画,最近他买了一支智能画原创 2016-06-02 13:52:52 · 679 阅读 · 0 评论 -
(二)S - S Lightoj 1008 【规律】
S - STime Limit:500MS Memory Limit:32768KB 64bit IO Format:%lld & %lluSubmit StatusDescriptionFibsieve had a fantabulous (yes, it's an actual word) birthday party this year. He原创 2016-06-01 19:07:38 · 551 阅读 · 0 评论 -
R - R 整除 【数学】
R - RTime Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64uSubmit StatusDescriptionFind the number of k-divisible numbers on the segment [a, b]. In other wor原创 2016-06-01 18:12:32 · 1119 阅读 · 0 评论 -
(二) Q - Q tricky sum
Q - QTime Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64uSubmit StatusDescriptionIn this problem you are to calculate the sum of all integers from 1 to n,原创 2016-06-01 13:49:31 · 218 阅读 · 0 评论 -
(二) P - P Save Luke 【数学】
P - PTime Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64uSubmit StatusDescriptionLuke Skywalker got locked up in a rubbish shredder between two presses. R2原创 2016-06-01 09:32:12 · 348 阅读 · 0 评论