2 条题解

  • 0
    @ 2024-7-22 8:35:26
    #include <bits/stdc++.h>
    using namespace std;
    
    int main() {
        freopen("mul.in", "r", stdin);
        freopen("mul.out", "w", stdout);
        
        vector<int> a(11, 0), b(11, 0), r(21, 0);
        
        for (int i = 0; i < 2; i++) {
            int c, p;
            cin >> c >> p;
            a[p] += c;
        }
    
        for (int i = 0; i < 2; i++) {
            int c, p;
            cin >> c >> p;
            b[p] += c;
        }
    
        for (int i = 0; i <= 10; i++) {
            for (int j = 0; j <= 10; j++) {
                r[i + j] += a[i] * b[j];
            }
        }
    
        for (int i = 20; i >= 0; i--) {
            if (r[i] != 0) {
                cout << r[i] << " " << i << endl;
            }
        }
        
        return 0;
    }
    

    信息

    ID
    167
    时间
    1000ms
    内存
    256MiB
    难度
    7
    标签
    (无)
    递交数
    156
    已通过
    33
    上传者