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\n");
printf("1\n");
continue;
}
ans = 2*a-1;
printf("%d 2\n",ans);
printf("1 2\n");
}
return 0;
}
CodeForces 867B Save the problem的更多相关文章
- B - Save the problem! CodeForces - 867B 构造题
B - Save the problem! CodeForces - 867B 这个题目还是很简单的,很明显是一个构造题,但是早训的时候脑子有点糊涂,想到了用1 2 来构造, 但是去算这个数的时候算错 ...
- [codeforces 528]B. Clique Problem
[codeforces 528]B. Clique Problem 试题描述 The clique problem is one of the most well-known NP-complete ...
- codeforces.com/contest/325/problem/B
http://codeforces.com/contest/325/problem/B B. Stadium and Games time limit per test 1 second memory ...
- Codeforces 442B Andrey and Problem(贪婪)
题目链接:Codeforces 442B Andrey and Problem 题目大意:Andrey有一个问题,想要朋友们为自己出一道题,如今他有n个朋友.每一个朋友想出题目的概率为pi,可是他能够 ...
- Codeforces 776D The Door Problem
题目链接:http://codeforces.com/contest/776/problem/D 把每一个钥匙拆成两个点${x,x+m}$,分别表示选不选这把钥匙. 我们知道一扇门一定对应了两把钥匙. ...
- codeforces 803G Periodic RMQ Problem
codeforces 803G Periodic RMQ Problem 题意 长度为\(1e5\)的数组复制\(1e4\)次,对新的数组进行区间覆盖和区间最小值查询两种操作,操作次数\(1e5\). ...
- [Codeforces 986E] Prince's Problem
[题目链接] https://codeforces.com/contest/986/problem/E [算法] X到Y的路径积 , 可以转化为X到根的路径积乘Y到根的路径积 , 除以LCA到根的路径 ...
- 【codeforces 527D】Clique Problem
[题目链接]:http://codeforces.com/contest/527/problem/D [题意] 一维线段上有n个点 每个点有坐标和权值两个域分别为xi,wi; 任意一对点(i,j) 如 ...
- 【codeforces 793C】Mice problem
[题目链接]:http://codeforces.com/contest/793/problem/C [题意] 给你每个点x轴移动速度,y轴移动速度; 问你有没有某个时刻,所有的点都"严格& ...
随机推荐
- vue框架(三)_vue引入jquery、bootstrap
一.vue安装jquery 1.按照之前博客的内容,新建一个vue工程. 2.在项目文件夹下,使用命令npm install jquery --save-dev 引入jquery. 3.在build/ ...
- 《大话设计模式》c++实现 之策略模式
一.UML图 二.概念 策略模式:他定义了算法家族,分别封装起来,让他们之间可以互相替换,此模式让算法的变化,不会影响到使用算法的客户. 三.优点 (1)策略模式是一种定义一系列算法的方法,从 ...
- 多语言(Java、.NET、Node.js)混合架构下开源调用链追踪APM项目初步选型
1. 背景 我们的技术栈包括了Java..NET.Node.js等,并且采用了分布式的技术架构,系统性能管理.问题排查成本越来越高. 2. 基本诉求 针对我们的情况,这里列出了选型的主要条件,作为最终 ...
- D. Duff in Beach
题意 数字串a[0---n-1], 通过不断的重复组成了 b[0,---l-1]l<10^18, 让你计算出 长度小于等于k的最长非递减子序列,满足,取得第 i 个取得是 L1 第i+1个取得 ...
- 压缩和解压缩(I)
ZipArchive 压缩方法 -(void)zipArchiveWithFiles { //创建解压缩对象 ZipArchive *zip = [[ZipArchive alloc]init]; / ...
- ReactiveCocoa(II)
RAC类关系图: RAC 信号源: 需要导入的头文件: import ReactiveCocoa import Result import ReactiveSwift 冷信号 //1.冷信号 let ...
- g++编译
命令: otool -L xx.lib 查看mac os 动态库依赖的包 ldd xx.so 查看linux动态库依赖的包 c++打包动态库java调用,mac上没问题到linux上就是不行,g++命 ...
- qt5.5.1 移植4412的问题过程
1.编译错误: ../WTF/wtf/unicode/wchar/UnicodeWchar.h: In function 'bool WTF::Unicode::isAlphanumeric(UCha ...
- 大数据和hadoop的一些基础知识
一.前言 大数据这个概念不用我提大家也听过很多了,前几年各种公开论坛.会议等场合言必及大数据,说出来显得很时髦似的.有意思的是最近拥有这个待遇的名词是“人工智能/AI”,当然这是后话. 众所周知,大数 ...
- JustOj 1415: 字符串解压
题目描述 豆豆非常调皮,总喜欢把一样的东西摆在一起,然后用神奇的猫爪功把他们揉成一团. 比如一堆A,就会被揉成个数+A. 这就是豆豆的字符串压缩算法了. 比如给豆豆一个字符串:ABBCCCDDDDEE ...