题目链接:http://115.28.76.232/problem?pid=1431 Sum vs Product Time Limit: 4000/2000MS (Java/Others)Memory Limit: 128000/64000KB (Java/Others) SubmitStatis
转载 2017-06-19 09:43:00
88阅读
2评论
Description       Peter has just learned mathematics. He learned how to add, and how to multiply. The fact that 2 + 2 = 2 × 2 has amazed him greatly. Now he wants find more such examples. Peters
原创 2022-11-09 18:24:05
46阅读
Sum vs ProductTime Limit:4000/2000MS (Java/Others)Memory Limit:128000/64000K
转载 2015-08-10 17:49:00
17阅读
题目大意:给出一个范围,要求找出这个范围内满足 n = x + y + z = x * y * z的所有式子解题思路:因为这里的小数位精确到了0.01,所以先讲x,y,z都相应放大100倍 从小到大枚举,假设x <= y <= z,那么x的范围就在 (0,n ^(1/3)],y的范围就在[x,(n-x)^(1/2)]这样范围就可以确定下来了 而z又可以通过x和y得到 因为x + y + z
原创 2023-04-07 10:47:04
36阅读
1. sum and product rules of probability ⎧⎩⎨p(x)=∫p(x,y)dyp(x,y)=p(x|y)p(y) sum rule of probability 的积分符号自然可以换成 ∑ 求和符号(针对离散型随机变量) 2. 简单应用 sum and product rules of probability in Bishop’s book sum
转载 2017-07-21 18:35:00
103阅读
2评论
AGC039F 一个$n*m$的矩阵,每个位置上可以填$[1,K]$的整数。 设$f_{i,j}\(表示与\)(i,j)$同行同列的数的最小值。 求所有的方案中$\prod_^n \prod_^m f_{i,j}$的值的和。 \(n,m,K\le 100\) 补题解。 首先题目可以等价成这样:设$B
转载 2020-09-29 21:05:00
120阅读
2评论
Given an integer number n, return the difference between the product of its digits and the sum of its digits. Example 1: Input: n = 234 Output: 15 Exp
转载 2019-12-19 05:33:00
112阅读
2评论
1281. Subtract the Product and Sum of Digits of an Integer*https://leetcode.com/problems/subtract-the
原创 2022-05-30 12:44:43
105阅读
"Link" 先考虑将问题进行转化,我们要对满足如下条件的大小为$n\times m$的矩阵$A,B$进行计数: 对任意$A_{i,j}(i\in[1,n],j\in[1,m])$,$B$中$B_{i,j}$所在行和列的每一个元素都不小于$A_{i,j}$。 也就是对于任意一个矩阵$B$,它在题意中
转载 2020-04-04 16:13:00
71阅读
2评论
我们先把问题分成两部分, 一部分是把元素往前移, 另一部分是把元素往后移。对于一个 i 后的一个位置, 我们考虑前面哪个移到这里来最优。 我们设最优值为val, val = max(a[ j ] * (i - j) - (sum[ i ] - sum[ j ]) 我们能发现这个能转换成斜率优化的形式
转载 2019-03-04 15:47:00
115阅读
2评论
DescriptionGiven an integer number n, return the difference between the product of
git
原创 2022-08-11 17:29:54
62阅读
A natural number, N, that can be written as the sum and product of a given set of at least two natural numbers, {a1, a2, ... , ak} is called a product
转载 2017-06-22 11:55:00
175阅读
2评论
accumulate template <class InputIterator,class T> T accumulate(InputIterator first, InputIterator last, T init) { for (; first != last; first++) { ini
原创 2021-07-08 13:53:24
121阅读
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1969算了前几个发现是A007773还给出了个公式:当n>=7, a(n) = (n^3-16n+27)/6 (n是奇数); (n^3-16n+30)/6 (n是偶
原创 2023-04-12 06:27:05
38阅读
\(\sum_{i=1}^{N-1}\sum_{j=i+1}^NA_iA_j=\sum_{i=1}^NA_i*(A_{i+1}+\cdots+A_N)\) const int N=2e5+10; int a[N]; LL sum[N]; int n; int main() { cin>>n; for
转载 2021-04-04 11:33:00
67阅读
 
原创 2021-07-05 16:40:47
743阅读
原创 2022-01-19 15:52:49
402阅读
题目描述:给出一个整数数组和一个目标值,判断数组中是否有两个数之和等于目标值1、粗暴的方法每次选中一个数,然后遍历整个数组,判断是否有另一个数使两者之和为target时间复杂度:O(n^2)2、利用集合可以优化时间复杂度思路:在遍历数组的过程中,用集合每次保存当前值。假如集合中已经有一个数等于目标值减去当前当前值,则证明在之前的遍历中一定有一个数与当前值之和等于目标值...
原创 2021-09-02 09:37:50
110阅读
problem 1281. Subtract the Product and Sum of Digits of an Integer solution#1: code 参考 1. leetcode_easy_math_1281. Subtract the Product and Sum of Dig
git
原创 2022-07-11 12:57:10
81阅读
以下算法均包含在头文件 numeric 中1.iota该函数可以把一个范围内的序列从给定的初始值开始累加先看用法。例:假设我需要一个长度为10,从5开始递增的序列 vector<int> a(10); iota(begin(a), end(a), 5); for (auto x : a) { cout << x << " ";
原创 2022-04-08 11:03:25
723阅读
  • 1
  • 2
  • 3
  • 4
  • 5