1 条题解

  • 0
    @ 2025-3-4 19:42:11

    #include

    int main() { int a; std::cin >> a;

    int count = 0;
    
    // 枚举 5 元的张数
    for (int five = 0; five * 5 <= a; ++five) {
        // 枚举 2 元的张数
        for (int two = 0; two * 2 + five * 5 <= a; ++two) {
            // 计算 1 元的张数
            int one = a - five * 5 - two * 2;
            // 只要能凑成 a 元,就增加一种兑换方法
            count++;
        }
    }
    
    std::cout << count << std::endl;
    
    return 0;
    

    }

    • 1

    信息

    ID
    133
    时间
    1000ms
    内存
    256MiB
    难度
    5
    标签
    (无)
    递交数
    42
    已通过
    17
    上传者