数学
花飞雨追
梦想不是浮躁,而是沉淀和积累。
展开
-
Leetcode 1716 计算力扣银行的钱
题目Hercy 想要为购买第一辆车存钱。他 每天 都往力扣银行里存钱。最开始,他在周一的时候存入 1 块钱。从周二到周日,他每天都比前一天多存入 1 块钱。在接下来每一个周一,他都会比 前一个周一 多存入 1 块钱。给你 n ,请你返回在第 n 天结束的时候他在力扣银行总共存了多少块钱。解题思路 先算完整的星期,再算剩余的。代码class Solution { public int totalMoney(int n) {原创 2022-01-15 00:18:06 · 129 阅读 · 0 评论 -
Leetcode 1518 换酒问题
题目小区便利店正在促销,用 numExchange 个空酒瓶可以兑换一瓶新酒。你购入了 numBottles 瓶酒。如果喝掉了酒瓶中的酒,那么酒瓶就会变成空的。请你计算 最多 能喝到多少瓶酒。解题思路 比如5个空瓶能换1个满瓶,单独拿1个空瓶出来相当于喝完如果有额外的4个瓶就能换成1个满瓶,那么只需要看有几个额外的4个瓶的组合即可。代码class Solution { public int numWaterBottles(int numBottles, int numExchange原创 2021-12-17 10:07:11 · 97 阅读 · 0 评论 -
Leetcode 268 丢失的数字
给定一个包含 [0, n] 中 n 个数的数组 nums ,找出 [0, n] 这个范围内没有出现在数组中的那个数。原创 2021-11-06 10:54:04 · 144 阅读 · 0 评论 -
HDU 6304 Chiaki Sequence Revisited(玄学找规律)
Chiaki Sequence Revisited(玄学找规律)Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1270 Accepted Submission(s): 324 题意 已知递推公式a[n]=a[i-...原创 2018-07-24 15:43:51 · 620 阅读 · 0 评论 -
POJ 2551 Ones
OnesTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 11696 Accepted: 6594DescriptionGiven any integer 0 <= n <= 10000 not divisible by 2 or 5, some multiple of n is a number which in de...原创 2017-04-08 16:18:47 · 454 阅读 · 0 评论 -
POJ 2262 Goldbach's Conjecture
Goldbach's ConjectureTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 45297 Accepted: 17255DescriptionIn 1742, Christian Goldbach, a German amateur mathematician, sent a letter to Leonhard Eu...原创 2017-04-08 20:19:36 · 1127 阅读 · 0 评论 -
POJ 2407 Relatives
RelativesTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 14350 Accepted: 7175DescriptionGiven n, a positive integer, how many positive integers less than n are relatively prime to n? Two int...原创 2017-04-08 22:36:21 · 367 阅读 · 0 评论 -
POJ 1401 Factorial
FactorialTime Limit: 1500MS Memory Limit: 65536KTotal Submissions: 16192 Accepted: 9984DescriptionThe most important part of a GSM network is so called Base Transceiver Station (BTS). These transceive...原创 2017-04-09 01:12:22 · 299 阅读 · 0 评论 -
51 Nod1073约瑟夫环
1073 约瑟夫环基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题 收藏 关注N个人坐成一个圆环(编号为1 - N),从第1个人开始报数,数到K的人出列,后面的人重新从1开始报数。问最后剩下的人的编号。例如:N = 3,K = 2。2号先出列,然后是1号,最后剩下的是3号。Input2个数N和K,表示N个人,数到K出列。(2 <= N, K <= 10^6)...原创 2017-06-04 23:50:21 · 304 阅读 · 0 评论 -
GYM 101498D Counting Paths(逆元求组合数)
GYM 101498 D - Counting Paths(逆元求组合数)### 题意 在一棵完全无限延伸的二叉树上,从顶点开始,给出路径的长度a和拐弯的次数b,问最多可以走多少种路径。解题思路 因为路径的长度a和拐弯的次数b已经知道了,所以我们不难发现,无论怎么走,路径上总有a+1个点,除去起点和终点不能拐弯,剩下的a-1个点都可以拐弯,那么我们就可以发现,路径的数量就是...原创 2018-05-09 13:46:37 · 371 阅读 · 0 评论 -
递推HDU2074
阿牛的EOF牛肉串Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 35849 Accepted Submission(s): 16888Problem Description今年的ACM暑期集训队一共有18人,原创 2017-04-15 15:40:54 · 262 阅读 · 0 评论 -
递推POJ2663
Tri TilingTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 10549 Accepted: 5347DescriptionIn how many ways can you tile a 3xn rectangle with 2x1 dominoes? Here is a sample tiling of a 3x12 re...原创 2017-04-15 15:10:51 · 648 阅读 · 0 评论 -
递推POJ2506
TilingTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 9979 Accepted: 4684DescriptionIn how many ways can you tile a 2xn rectangle by 2x1 or 2x2 tiles? Here is a sample tiling of a 2x17 recta...原创 2017-04-15 00:19:48 · 358 阅读 · 0 评论 -
POJ1006中国剩余定理
BiorhythmsTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 136150 Accepted: 43524DescriptionSome people believe that there are three cycles in a person's原创 2017-04-27 21:07:50 · 267 阅读 · 0 评论 -
POJ2231奶牛叫
Moo VolumeTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 22151 Accepted: 6712DescriptionFarmer John has received a noise complaint from his neighbor, F原创 2017-04-13 11:20:16 · 579 阅读 · 0 评论