codeforces Codeforces Round #597 (Div. 2) B. Restricted RPS 暴力模拟
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
char x[];
char xx[];
int main() {
int t;
cin>>t;
while(t--) {
int a,b,c,n;
cin>>n>>a>>b>>c;
for(int i=; i<n; i++) xx[i]=;
scanf("%s",x);
int r=,p=,s=;
for(int i=; i<n; i++) {
if(x[i]=='R') r++;
else if(x[i]=='P') p++;
else s++;
}
int ans=;
ans+=min(r,b);
ans+=min(p,c);
ans+=min(s,a);
if(ans>=(n+)/) {
printf("YES\n");
for(int i=; i<n; i++) {
if(x[i]=='R'&&b>) {
xx[i]='P';
b--;
} else if(x[i]=='P'&&c>) {
xx[i]='S';
c--;
} else if(x[i]=='S'&&a>) {
a--;
xx[i]='R';
}
}
for(int i=; i<n; i++) {
if(xx[i]==) {
if(a>) {
printf("R");
a--;
} else if(b>) {
printf("P");
b--;
} else if(c>) {
c--;
printf("S");
}
} else printf("%c",xx[i]);
}
printf("\n");
} else {
printf("NO\n");
}
}
return ;
}
codeforces Codeforces Round #597 (Div. 2) B. Restricted RPS 暴力模拟的更多相关文章
- Codeforces Round #597 (Div. 2) B. Restricted RPS
链接: https://codeforces.com/contest/1245/problem/B 题意: Let n be a positive integer. Let a,b,c be nonn ...
- Codeforces Round #164 (Div. 2) A. Games【暴力/模拟/每个球队分主场和客场,所有球队两两之间进行一场比赛,要求双方球服颜色不能相同】
A. Games time limit per test 1 second memory limit per test 256 megabytes input standard input outpu ...
- Codeforces Beta Round #80 (Div. 2 Only)【ABCD】
Codeforces Beta Round #80 (Div. 2 Only) A Blackjack1 题意 一共52张扑克,A代表1或者11,2-10表示自己的数字,其他都表示10 现在你已经有一 ...
- Codeforces Beta Round #83 (Div. 1 Only)题解【ABCD】
Codeforces Beta Round #83 (Div. 1 Only) A. Dorm Water Supply 题意 给你一个n点m边的图,保证每个点的入度和出度最多为1 如果这个点入度为0 ...
- Codeforces Beta Round #79 (Div. 2 Only)
Codeforces Beta Round #79 (Div. 2 Only) http://codeforces.com/contest/102 A #include<bits/stdc++. ...
- Codeforces Beta Round #77 (Div. 2 Only)
Codeforces Beta Round #77 (Div. 2 Only) http://codeforces.com/contest/96 A #include<bits/stdc++.h ...
- Codeforces Beta Round #76 (Div. 2 Only)
Codeforces Beta Round #76 (Div. 2 Only) http://codeforces.com/contest/94 A #include<bits/stdc++.h ...
- Codeforces Beta Round #75 (Div. 2 Only)
Codeforces Beta Round #75 (Div. 2 Only) http://codeforces.com/contest/92 A #include<iostream> ...
- Codeforces Beta Round #74 (Div. 2 Only)
Codeforces Beta Round #74 (Div. 2 Only) http://codeforces.com/contest/90 A #include<iostream> ...
随机推荐
- MVC开发模式以及Smarty模板引擎的使用
Linux 全局安装 composer 将目录切换到/usr/local/bin/目录 cd /usr/local/bin/ 在 bin 目录中下载 composer curl -sS https:/ ...
- 使用 Hyper-V 替代 VMware
目前我又用回了vmware,原因是,Hyper-V性能不如vmware,而且导出的虚拟机文件,再导入会出现奇怪的问题.不省心. Hyper-V是什么 Hyper-V硬件要求为Windows 10 企业 ...
- 【pattern】设计模式(2) - 模版方法模式
前言 一晃一年又过了,还是一样的渣. 一晃2周又过去了,还是没有坚持写博客. 本来前2天说填一下SQL注入攻击的坑,结果看下去发现还是ojdbc.jar中的代码,看不懂啊.这坑暂时填不动,强迫在元旦最 ...
- 在eclipse更新启动项目
说明:figfree是基于模块化开发,代码重用,可拆解性高. 功能模块分为:接口工程(*.Iface).接口实现工程(*.Impl).客户端工程(*.Client) 接口工程(*.Iface):对其他 ...
- java中数据类型转换注意事项
1.byte.short.char这三种类型互相做数学运算时都会先提升为int类型后再做运算 char a = 'A'; short b = 1; int num = a + b;//a和b在做运算前 ...
- Eigen库学习---Map类
Eigen中定义了一系列的vector和matrix,相比copy数据,更一般的方式是复用数据的内存,将它们转变为Eigen类型.Map类很好地实现了这个功能. Map定义 Map(PointerAr ...
- Vue tinymce富文本编辑器
tinymce 官方为 vue 项目提供了一个组件 tinymce-vue 一.安装tinymce-vue npm install @tinymce/tinymce-vue -S 二.下载tinymc ...
- linux100讲——03 什么是linux
1.linux 有两种含义: 一种是linus 编写的开源操作系统的内核 另一种是广义的操作系统 2.linux的第一印象 服务端操作系统和客户端操作系统要做的事情不一样 命令行操作方式与图形界面的差 ...
- linux c++调试日志函数
#ifndef MYLOG_H #define MYLOG_H #include <stdio.h> #define __DEBUG__ #ifdef __DEBUG__ #define ...
- H5_0015:判断是否是微信加载
var e = document.createElement("script"); e.src = "https://res.wx.qq.com/open ...