#include<stdio.h>
char str[100100];
int main()
{
int n,k,a,b;
scanf("%d%d%d%d",&n,&k,&a,&b);
char A='G',B='B';
if( a > b)
{
a^=b^=a^=b;
A^=B^=A^=B;
}
for(int i=0;i<n;i++)
str[i] = B;
for(int i=k;i<n;i += k+1)
{
if( a == 0)
{
printf("NO\n");
return 0;
}
str[i]=A;
a--;
}
for(int i=0;i<n && a > 0;i++)
{
if( str[i] == A || ( i-1>0 && str[i-1] == A ) || ( i+1<n && str[i+1] ==A))
continue;
str[i] = A;
a--;
}
for(int i=0;i<n;i++)
printf("%c",str[i]);
return 0;
}
codeforces #386 div2 D. Green and Black Tea
最新推荐文章于 2022-11-22 23:15:14 发布
Innokentiy计划喝n杯茶,他有a袋绿茶和b袋红茶,但他不想连续喝超过k杯同一种茶。你的任务是确定泡茶顺序,使得Innokentiy能按要求喝到n杯茶,或者判断这是否不可能。每袋茶只能用一次。
摘要由CSDN通过智能技术生成