题目描述
blablabla
样例
blablabla
算法1
(暴力枚举) $O(n^2)$
blablabla
时间复杂度
参考文献
C++ 代码
#include<algorithm>
#include<iostream>
using namespace std;
const int N = 100010, mod = 1e9 + 7;
int f[N];
int m, n;
int main()
{
cin >> m >> n;
int h = 0;
for (; h * (h + 1) / 2 <= m + n; h ++);
h --;
f[0] = 1;
for (int i = 1; i <= h; i ++)
for (int j = n; j >= i; j --)
f[j] = (f[j] + f[j - i]) % mod;
int res = 0;
for (int i = 0; i <= n; i ++)
if (i + m >= h * (h + 1) / 2)
res = (res + f[i]) % mod;
cout << h << " " << res;
return 0;
}
算法2
(暴力枚举) $O(n^2)$
blablabla
时间复杂度
参考文献
C++ 代码
blablabla