Codeforces Round #597 DIV2 B問題 (750pt)
Problem description
省略
省略
C++に変換後のコードはこちら
//no-unlocked
int N, A, B, C;
char S[102];
char res[102];
{
int win;
REP(rd_int()){
rd(N,A,B,C,S);
rep(i,N) res[i] = 0;
win = 0;
rep(i,N){
if(S[i]=='S' && A > 0) res[i] = 'R', A--, win++;
if(S[i]=='R' && B > 0) res[i] = 'P', B--, win++;
if(S[i]=='P' && C > 0) res[i] = 'S', C--, win++;
}
rep(i,N) if(res[i]==0){
if(A > 0) A--, res[i] = 'R', continue;
if(B > 0) B--, res[i] = 'P', continue;
if(C > 0) C--, res[i] = 'S', continue;
}
res[N] = '\0';
if[2 win >= N, wtLn("YES", res), wt("NO")];
}
}
Current time: 2024年03月19日14時28分59秒
Last modified: 2019年11月02日02時56分43秒 (by laycrs)
Tags: Competitive_Programming_Incomplete Codeforces CF597 CF_Div2_B
トップページに戻る
Logged in as: unknown user (not login)