#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define rep(i,n) repl(i,0,n) #define mp(a,b) make_pair((a),(b)) #define pb(a) push_back(a) #define all(x) (x).begin(),(x).end() #define dbg(x) cout<<#x"="<<(x)<>x>>y>>z; int a,b; int g = extgcd(x, y, a, b); // ax + by = g if(z%g!=0 || (a==0 && b==0)){ return false; } string push="", pop=""; bool flg=false; string xx="c", yy="w"; if(x x){ if(z/x > 5000) return false; rep(i, z/x){ push += xx; pop += "C"; } z = z%x; flg=true; } if(z > y){ if(pop.size() + z/y > 5000) return false; rep(i, z/y){ push += yy; pop += "C"; } z = z%b; flg=true; } if(z==0){ cout< 10000) return false; push="";pop=""; if(a<0){ rep(i,-a) push += "c"; rep(i,-a) pop = "W" + pop; } if(b<0){ rep(i,-b) push += "w"; rep(i,-b) pop = "W" + pop; } if(a>0){ rep(i,a) push += "c"; rep(i,a) pop = "C"+pop; } if(b>0){ rep(i,b) push += "w"; rep(i,b) pop = "C"+pop; } pop = pop.substr(1); rep(i,z/g){ res += push + pop; if(i!=0) res += "C"; } if(flg) res += "C"; if(res.size()>10000) return false; else cout<