zoukankan      html  css  js  c++  java
  • CodeForces 867B Save the problem

    B. Save the problem! http://codeforces.com/contest/867/problem/B

    time limit per test

    2 seconds

    memory limit per test

    256 megabytes

    input

    standard input

    output

    standard output

    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.

    Examples

    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

    题意:先给你一个数 a 表示方案数,   让你任意来给出两行 第一行两个数 n 和 m,第二行 m 个数  ,即 你所给出的 m个数 有a种不同的方案可以构成n ,与正常题刚好反过来,那么我们只要考虑最简单的情况 1 和 2 ,那么n = a*2+1

    #include<bits/stdc++.h>
    using namespace std;
    const int maxn = 1e5+5;
    const int inf = 0x3f3f3f3f;
    int main()
    {
        ios::sync_with_stdio(false);
        int a,ans;
        while(cin >> a)
        {
          if(a==1)
          {
              printf("1 1
    ");
              printf("1
    ");
              continue;
          }
          ans = 2*a-1;
          printf("%d 2
    ",ans);
          printf("1 2
    ");
        }
        return 0;
    }
  • 相关阅读:
    uwsgi wsgi nginx centos7.2部署flask
    以守护进程的方式部署flask
    新装Centos7.2 配置防火墙
    django 编程小结
    install plugin elasticsearch-analysis-ik
    为什么配置环境总是出现个各种问题呢?
    configure HDFS(hadoop 分布式文件系统) high available
    ConstraintLayout UI性能分析
    Android处理滑动与点击事件的冲突
    android自定义渐变圆环进度条
  • 原文地址:https://www.cnblogs.com/llke/p/10780141.html
Copyright © 2011-2022 走看看