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轴移动速度; 问你有没有某个时刻,所有的点都"严格& ...
随机推荐
- C#中换行的代码
1.Windows 中的换行符"\r\n"2.Unix/Linux 平台换行符是 "\n".3.MessageBox.Show() 的换行符为 "\n ...
- STL之List容器
1.List容器 1) list是一个双向链表容器,可高效地进行插入删除元素. 2)list不可以随机存取元素,所以不支持at.(pos)函数与[]操作符.It++(ok) it+5(err) 3)头 ...
- RepRap Prusa i3 平台自動補正
RepRap Prusa i3 平台自動補正 平台校正不但費時,而且經常失敗,時在是很令人洩氣!期盼了好一陣子,Marlin終於將平台自動補正的功能加進來了!!這個功能將原本Z軸的Endstop,改裝 ...
- hdu5302 构造
题意:给你一个无向图,它的边要么是黑色要么是白色,且图上的每个点最多与两个黑边两个白边相连.现在,Demon将图分成两部分,一部分包含所有的黑边,另一部分包括所有的白边,给你白边图中度为0的点的数量w ...
- django models数据库操作
一.数据库操作 1.创建model表 基本结构 1 2 3 4 5 6 from django.db import models class userinfo(models.M ...
- 创建一个简单的WCF程序2——手动开启/关闭WCF服务与动态调用WCF地址
一.创建WCF服务器 1.创建WCF服务器的窗体应用程序 打开VS2010,选择文件→新建→项目菜单项,在打开的新建项目对话框中,依次选择Visual C#→Windows→Windows窗体应用程序 ...
- sparkStrming 实时插入 mysql 今天使用echart 实现了简单数据展示 很low 但学习必须加深
- glog日志库移植Android平台
1.在linux平台下使用ndk交叉编译链编译glog生成libglog.a静态库. 2.将生成的库文件与头文件放到Android项目中,使用JNI方法调用. 3.编译遇到错误“stderr.stdo ...
- Linux 安装 mysql 数据库
1. 克隆虚拟机 2. 上传安装文件 1.上传文件 2.解压文件 tar -xvf 文件 3. 安装数据库 安装顺序: .debuginfo .shared .client .server 1. rp ...
- kivy 滑动
from kivy.uix.gridlayout import GridLayout from kivy.app import App from kivy.lang.builder import Bu ...