CodeForces
来源:互联网 发布:越南网络歌 编辑:程序博客网 时间:2024/05/16 07:27
CodeForces - 148C
«Next please», — the princess called and cast an estimating glance at the next groom.The princess intends to choose the most worthy groom, this is, the richest one. Whenever she sees a groom who is more rich than each of the previous ones, she says a measured «Oh...». Whenever the groom is richer than all previous ones added together, she exclaims «Wow!» (no «Oh...» in this case). At the sight of the first groom the princess stays calm and says nothing.The fortune of each groom is described with an integer between 1 and 50000. You know that during the day the princess saw n grooms, said «Oh...» exactly a times and exclaimed «Wow!» exactly b times. Your task is to output a sequence of n integers t1, t2, ..., tn, where ti describes the fortune of i-th groom. If several sequences are possible, output any of them. If no sequence exists that would satisfy all the requirements, output a single number -1.
Input
The only line of input data contains three integer numbers n, a and b (1 ≤ n ≤ 100, 0 ≤ a, b ≤ 15, n > a + b), separated with single spaces.
Output
Output any sequence of integers t1, t2, ..., tn, where ti (1 ≤ ti ≤ 50000) is the fortune of i-th groom, that satisfies the given constraints. If no sequence exists that would satisfy all the requirements, output a single number -1.
Example
Input
10 2 3Output5 1 3 6 16 35 46 4 200 99Input5 0 0Output10 10 6 6 5
Note
Let's have a closer look at the answer for the first sample test. The princess said «Oh...» (highlighted in bold): 5 1 3 6 16 35 46 4 200 99. The princess exclaimed «Wow!» (highlighted in bold): 5 1 3 6 16 35 46 4 200 99.
#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>#include <cmath>using namespace std;int main(){ int n,o,w; scanf("%d%d%d",&n,&o,&w); int a[110]; a[1]=1; int sum=1; int xx=1; for (int i=2;i<=n;i++){ if (w){ xx=sum+1; //a[i]=xx; w--; } else if (o&&i>2){ xx++; //a[i]=xx; o--; } a[i]=xx; sum+=xx; } if (w||o){ printf("-1\n"); } else{ for (int i=1;i<=n;i++){ printf("%d%c",a[i],i!=n?' ':'\n'); } } return 0;}
阅读全文
0 0
- codeforces~~~
- Codeforces
- codeforces
- Codeforces
- codeforces
- codeforces
- Codeforces
- Codeforces
- CodeForces
- CodeForces
- CodeForces
- CodeForces
- CodeForces
- Codeforces
- Codeforces
- Codeforces
- Codeforces
- Codeforces
- windows下easyBCD引导安装ubutu14.04双系统
- 艾灸是不是真那么神奇?
- CodeForces
- tensorflow构建神经网络回归分析可视化
- 在shell中创建文件的三种姿势-echo-cat-vi
- CodeForces
- 【算法题】黑化的牛牛
- leetcode507: Perfect Number
- Linux-死锁
- unity里面聚光灯(SPOT)光照计算学习!
- 图像的配准——MATLAB实现
- CodeForces
- JZOJ 1752. 无聊的草稿
- Atom-markdown推荐插件