zoukankan      html  css  js  c++  java
  • codeforces 867B

    Save the problem!

    Attention: we lost all the test cases for this problem, so instead of solving the problem, we need you to generate test cases. We're going to give you the answer, and you need to print a test case that produces the given answer. The original problem is in the following paragraph.


    People don't use cash as often as they used to. Having a credit card solves some of the hassles of cash, such as having to receive change when you can't form the exact amount of money needed to purchase an item. Typically cashiers will give you as few coins as possible in change, but they don't have to. For example, if your change is 30 cents, a cashier could give you a 5 cent piece and a 25 cent piece, or they could give you three 10 cent pieces, or ten 1 cent pieces, two 5 cent pieces, and one 10 cent piece. Altogether there are 18 different ways to make 30 cents using only 1 cent pieces, 5 cent pieces, 10 cent pieces, and 25 cent pieces. Two ways are considered different if they contain a different number of at least one type of coin. Given the denominations of the coins and an amount of change to be made, how many different ways are there to make change?


    As we mentioned before, we lost all the test cases for this problem, so we're actually going to give you the number of ways, and want you to produce a test case for which the number of ways is the given number. There could be many ways to achieve this (we guarantee there's always at least one), so you can print any, as long as it meets the constraints described below.

    Input
    Input will consist of a single integer A (1 ≤ A ≤ 105), the desired number of ways.


    Output
    In the first line print integers N and M (1 ≤ N ≤ 106, 1 ≤ M ≤ 10), the amount of change to be made, and the number of denominations, respectively.


    Then print M integers D1, D2, ..., DM (1 ≤ Di ≤ 106), the denominations of the coins. All denominations must be distinct: for any i ≠ j we must have Di ≠ Dj.


    If there are multiple tests, print any of them. You can print denominations in atbitrary order.


    Example
    Input
    18
    Output
    30 4
    1 5 10 25
    Input
    3
    Output
    20 2
    5 2
    Input
    314
    Output
    183 4
    6 5 2 139

    题意:给出方案数,求出满足这个方案数的任意一个面值搭配和硬币个数和价钱。

    思路:只要是满足这个方案数的就可以所以就找1和2就可以了。那么如果是1和2的硬币,组合数是A种的话,那么它的价钱就是2*(A-1)(开始有点纠结这个怎么算的,想想发现:如果是x元由1元和2元分的话,方案数是(x/2)+1;,那么x就等于2*(A-1);),然后就只用特判1的情况。

    #include<stdio.h>
    #include<iostream>
    #include<algorithm>
    using namespace std;
    int main()
    {
        int n;
        while(~scanf("%d",&n))
        {
            if(n==1)
            {
                printf("1 1
    1
    ");
            }
            else
                printf("%d 2
    1 2
    ",2*(n-1));
        }
    
    }
    



     
  • 相关阅读:
    模块化+定制化,PIX赋能多种行业实现低速无人车商业化
    支持Apollo、Autoware,PIX推出自动驾驶开发套件PIXKIT
    专为自动驾驶开发者打造的线控底盘——PIXLOOP
    甄别信息、病毒追踪、无人配送...这9个全球开源工具助力疫情抗击
    PIX无损线控改装——全系列车型及性能介绍
    PIX线控改装技术连载二 | 车辆组成模块之间的共同语言
    PIX入选Autodesk硅谷技术中心,以生成设计和金属增材制造落地L4自动驾驶通用底盘
    线控CRV,最高性价比的自动驾驶开发平台
    线控改装技术连载一之——线控开端和车辆组成
    CSS 创建
  • 原文地址:https://www.cnblogs.com/da-mei/p/9053330.html
Copyright © 2011-2022 走看看