思路: 容斥. 实现: #include <bits/stdc++.h> using namespace std; typedef long long ll; ; ; ll f[MAXN + ], inv[MAXN + ]; ll pow(ll a, ll b) { ll res = ; while (b) { ) res = res * a % MOD; b >>= ; a = a * a % MOD; } return res; } void init() { f[] = ;…
题目连接:357 - Let Me Count The Ways 题目大意:有5种硬币, 面值分别为1.5.10.25.50,现在给出金额,问可以用多少种方式组成该面值. 解题思路:和uva674是一样的, 只是上限不一样, 还有注意下输出. #include <stdio.h> #include <string.h> const int N = 30005; const int val[5] = {1, 5, 10, 25, 50}; long long cnt[N]; void…
递归函数 函数内部直接或间接的调用函数自身 将复杂问题简单化 例子程序 def sum_digits(n): """Return the sum of the digits of positive integer n.""" if n < 10: return n else: all_but_last, last = n // 10, n % 10 return sum_digits(all_but_last) + last 各位数字之和问…