«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, whereti 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.
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 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.
10 2 3
5 1 3 6 16 35 46 4 200 99
5 0 0
10 10 6 6 5
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <queue>
#include <stack>
#include <vector>
using namespace std;
int main(){
int n, a, b;
cin >> n >> a >> b;
if(n-a==1&&!b&&a) //如果n-a==1则说明所有数都比前一个大;第二个比第一个大,此时应该
{ //WOW,b就应该为1,a为n-2;与前提矛盾;
cout<<"-1"<<endl;
return 0;
}
int f[1000];
memset(f, 0, sizeof(f));
f[1]=1;
int i=1;
int sum=1;
for(i=2; i<=b+1; i++){
f[i]=sum+1;
sum+=f[i];
}
if(b==0){
f[2]=1;
i++;
b=1;
}
for(; i<=a+b+1; i++)
f[i]=f[i-1]+1;
for(; i<=n; i++)
f[i]=1;
for(i=1; i<=n; i++)
printf("%d%c", f[i], i==n?'\n':' ');
return 0;
}