Codeforces Round #437 B. Save the problem!
题意:
给你一个方案数,要求你输出满足该条件的总金额,面值数,和各个面值是多少,答案有多个,随便输出一个即可。
18
30 4
1 5 10 25
3
20 2
5 2
314
183 4
6 5 2 139 思路:如果A是1,那么就用1张1元的就好;如果大于1,价格都是2*(A-1),硬币只有1和2,因为,你用(A-1)个2元0个1元,然后是(A-2)个2个1元,这样方案数就相当于A-1减到0,共A种,方法十分巧妙。
代码:
#include<iostream>
using namespace std; int main(){
int n;
cin>>n;
if(n==1){
cout<<"1 1\n1\n";
}
else {
cout<<2*(n-1)<<' '<<2<<endl<<1<<' '<<2<<endl;
}
return 0;
}
Codeforces Round #437 B. Save the problem!的更多相关文章
- Codeforces Round #437 (Div. 2)[A、B、C、E]
Codeforces Round #437 (Div. 2) codeforces 867 A. Between the Offices(水) 题意:已知白天所在地(晚上可能坐飞机飞往异地),问是否从 ...
- Educational Codeforces Round 40 F. Runner's Problem
Educational Codeforces Round 40 F. Runner's Problem 题意: 给一个$ 3 * m \(的矩阵,问从\)(2,1)$ 出发 走到 \((2,m)\) ...
- Codeforces Round #437 (Div. 2, based on MemSQL Start[c]UP 3.0 - Round 2)
Problem A Between the Offices 水题,水一水. #include<bits/stdc++.h> using namespace std; int n; ]; i ...
- 【Codeforces Round #437 (Div. 2) B】Save the problem!
[链接]h在这里写链接 [题意] 给你一个金额N,和硬币的类型总数M; (完全背包),然后问你组成N的方案数. 使得,用这些硬币组成价值为N的金额的方案数为A; 现在A ...
- Codeforces Round #367 (Div. 2) Hard problem
Hard problem 题意: 有n个字符串,对第i个字符串进行反转操作代价为ci. 要使n个字符串按照字典序从小到大排列,最小的代价是多少. 题解: 反转就是reverse操作,比如说45873反 ...
- Educational Codeforces Round 34 A. Hungry Student Problem【枚举】
A. Hungry Student Problem time limit per test 1 second memory limit per test 256 megabytes input sta ...
- [Codeforces Round #296 div2 D] Clique Problem 【线段树+DP】
题目链接:CF - R296 - d2 - D 题目大意 一个特殊的图,一些数轴上的点,每个点有一个坐标 X,有一个权值 W,两点 (i, j) 之间有边当且仅当 |Xi - Xj| >= Wi ...
- Codeforces Round #437 Div. 1
A:显然构造一组只包含1和2面值的数据即可. #include<iostream> #include<cstdio> #include<cmath> #includ ...
- Codeforces Round #437 E. Buy Low Sell High
题意:买卖股票,给你n个数,你可以选择买进或者卖出或者什么都不做,问你最后获得的最大收益是多少. Examples Input 910 5 4 7 9 12 6 2 10 Output 20 Inpu ...
随机推荐
- vue2.0 父子组件通信 兄弟组件通信
父组件是通过props属性给子组件通信的来看下代码: 父组件: <parent> <child :child-com="content"></chil ...
- ue4 C++ json数据的读写
这是改变恢复机制的json文件的例子 //写入 TSharedPtr<FJsonObject> RootObject = MakeShareable(newFJsonObject); T ...
- ubuntu18.04安装openresty
ubuntu18.04使用openresty官方APT源安装openresty 添加openresty的 APT 仓库,这样就可以便于未来安装或更新软件包(通过 apt-get update 命令). ...
- System Generator 生成IP核在Vivado中进行调用
System Generator 生成IP核在Vivado中进行调用 1.首先在Simulink中搭建硬件模型 2.查看仿真结果 3.资源分析与时序分析 4.启动vivado,关联生成的IP核 5.调 ...
- 加密与解密md5 3des
/// <summary> /// MD5加密 /// </summary> /// <param name="s"></param> ...
- linux--切换ipython解释器到python3
Ipython修改为python3解释器: which ipython --得到路径 cat 路径--查看执行的解释器版本 sudo gedit 路径--修改解释器版本为python3 保存即可,保存 ...
- Delphi调用大漠插件示例
Delphi XE2 版本调用大漠插件方法:打开Component->Import Component->默认Import a Type Library,点击Next->找到Dm.d ...
- C#编程经验-enum and struct
enum,store fixed values,use array replace,not use this data-structurestruct,store several variables, ...
- 模拟实现简单ATM功能
- 浅析负载均衡的6种算法,Ngnix的5种算法。
浅析负载均衡的6种算法,Ngnix的5种算法.浮生偷闲百家号03-21 10:06关注内容导读其实际效果越来越接近于平均分配调用量到后端的每一台服务器,也就是轮询的结果.源地址哈希的思想是根据获取客 ...