2 3
GBBG
#include<bits/stdc++.h> using namespace std; typedef long long ll; inline int read() { int x=0,f=1;char ch=getchar(); while(ch<‘0‘||ch>‘9‘){if(ch==‘-‘)f=-1;ch=getchar();} while(ch>=‘0‘&&ch<=‘9‘){x=x*10+ch-‘0‘;ch=getchar();} return x*f; } #define pi 3.14159265358979323846 const int INF=0x3f3f3f3f; const int mod=10007; const int maxn=1e6+100; const int maxa=521; vector<int>t; int n,m; void inint(){ cin>>n>>m; for(int i=0;i<2*n;i++){ t.push_back(i); } } int main(){ inint(); int pos=0; for(int i=0;i<n;i++){ pos=(pos+m-1)%t.size(); t.erase(t.begin()+pos); } int j=0; for(int i=0;i<2*n;i++){ if(!(i%50)&&i) cout<<endl; if(j<t.size()&&i==t[j]){ j++; cout<<"G"; } else{ cout<<"B"; } } }
原文:https://www.cnblogs.com/lipu123/p/13050683.html