• 【Codeforces Round #437 (Div. 2) B】Save the problem!


    【链接】h在这里写链接


    【题意】


        给你一个金额N,和硬币的类型总数M;
        (完全背包),然后问你组成N的方案数.
        使得,用这些硬币组成价值为N的金额的方案数为A;
        现在A已知,让你求出一组合法的N,M以及每个硬币的面值。


    【题解】


    只要面值为1和面值为2。
    做个完全背包。就能发现这两个能够覆盖到所有的方案数。

    【错的次数】


    0

    【反思】


    在这了写反思

    【代码】

    #include <bits/stdc++.h>
    using namespace std;
    
    long long bo[(int)1e6+10];
    int can[(int)1e6+10];
    int d[15];
    map <int,int> dic;
    
    int main()
    {
        //freopen("F:\rush.txt","r",stdin);
    
        bo[0] = 1;
        for (int i = 1;i <= 2;i++)
            for (int j = i;j <= (int) 1e6;j++)
                bo[j] += bo[j-i];
    
        int A,N,M;
        ios::sync_with_stdio(0),cin.tie(0);
        cin >> A;
        for (int i = 1;i <= (int) 1e6;i++)
            if (bo[i]==A)
            {
                cout << i <<' ';
                break;
            }
        cout << 2 << endl;
        cout <<"1 2"<<endl;
        return 0;
    }


  • 相关阅读:
    js 简单排序
    封装Vue轮播图
    MonggoDB 基本操作
    Node + MVC模式 登录注册 小示例
    Node__Express
    Canvas 碎碎念
    vue 动态添加 删除 属性
    Vue 下 浏览器 点击实现复制功能
    电脑共享无线网
    抓包tcpdump
  • 原文地址:https://www.cnblogs.com/AWCXV/p/7625975.html
Copyright © 2020-2023  润新知