CodeForces 867B Save the problem!
来源:互联网 发布:五金进销存软件 编辑:程序博客网 时间:2024/06/06 17:05
题目链接:http://codeforces.com/contest/867/problem/B
题意:有一个数n,可以被若干个数组合合成,且组合的方法数为x,现在告诉你x,让你给出n和那若干个数
解析:之所以有那么多种方法,是因为有些数字是可以通过倍数关系来相互替代,然后1和2是可以组成全部数字的,而且两个1可以代替一个2,所以随着数字的增大,方法数也一定是增大的,所以找一下规律,逆推一下即可
#include <bits/stdc++.h>using namespace std;int main(void){ int n; scanf("%d",&n); if(n==1) puts("1 1\n1"); else printf("%d 2\n1 2\n",2*(n-1)); return 0;}
阅读全文
0 0
- CodeForces 867B Save the problem!
- Codeforces Round #437 (Div. 2) B. Save the problem!
- codeforces 865A Save the problem!
- Save the problem!
- Codeforces Problem 708B Recover the String(implementation&math)
- Problem--266B--Codeforces--Queue at the School
- Problem - 216B - Codeforces
- Problem - 218B - Codeforces
- codeforces problem/408/B
- Codeforces Problem - 50B
- Problem - 376B - Codeforces
- problem - 616B -codeforces
- Codeforces Problem 333B
- Codeforces Problem 332B
- The four boys save money's problem
- The Door Problem CodeForces
- codeforces-Problem 193B - Xor
- Codeforces Problem 499B. Lecture
- 240 Search a 2D Matrix II
- 错误解决方案__20161031重仿.png
- Learning Python Part II 之 作用域(scope)
- KMP求最小覆盖子矩阵
- ubuntu中默认Python2和Python3的转换命令
- CodeForces 867B Save the problem!
- JZOJ 5404. 【NOIP2017提高A组模拟10.10】Graph
- Python 用栈模拟递归
- js原型链
- Leetcode 算法习题 第六周
- Appium Appium 文档翻译计划 2017 完成!
- 实现一个函数判断year是不是闰年。
- FastDFS学习
- 海康笔试题--字符串分割