详解见:http://bonniebbs.is-programmer.com/posts/40073.html
#include <iostream> #include <cstring> #define N 10005 using namespace std; int main() { int n, m, a, b, ans; int c1[N], c2[N]; while(cin >> n >> m) { memset(c1, 0, sizeof(c1)); memset(c2, 0, sizeof(c2)); ans = 0; cin >> a >> b; for(int i=a; i<=b&i<=m; i++) { c1[i] = 1; } n--; while(n--) { cin >> a >> b; for(int i=0; i<=m; i++) { for(int j=a; j<=b; j++) { if(i+j<=m) { c2[i+j] += c1[i]; } } } for(int i=0; i<=m; i++) { c1[i] = c2[i]; c2[i] = 0; } } cout << c1[m] << endl; } return 0; }
2022年11月04日 02:50
Life insurance policies are a fundamental priority for Indian citizens. With life uncertainties, one requires an insurance cover to cater for all challenges which may arise. How to Pay LIC Online Payment India has the best public sector insurance company LIC (Life Insurance Corporation of India) which provides quality services across India. The company was establish on 1st September 1956 to help in life insurance matters.