Codeforces Round #742 (Div. 2)

简介: Codeforces Round #742 (Div. 2)

A. Domino Disaster

time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output


Alice has a grid with 22 rows and nn columns. She fully covers the grid using nn dominoes of size 1×21×2 — Alice may place them vertically or horizontally, and each cell should be covered by exactly one domino.


Now, she decided to show one row of the grid to Bob. Help Bob and figure out what the other row of the grid looks like!


Input


The input consists of multiple test cases. The first line contains an integer tt (1≤t≤50001≤t≤5000) — the number of test cases. The description of the test cases follows.


The first line of each test case contains an integer nn (1≤n≤1001≤n≤100) — the width of the grid.


The second line of each test case contains a string ss consisting of nn characters, each of which is either L, R, U, or D, representing the left, right, top, or bottom half of a domino, respectively (see notes for better understanding). This string represents one of the rows of the grid.


Additional constraint on the input: each input corresponds to at least one valid tiling.


Output


For each test case, output one string — the other row of the grid, using the same format as the input string. If there are multiple answers, print any.


Example


input

Copy

4

1

U

2

LR

5

LRDLR

6

UUUUUU


output

Copy

D

LR

LRULR

DDDDDD

Note


In the first test case, Alice shows Bob the top row, the whole grid may look like


In the second test case, Alice shows Bob the bottom row, the whole grid may look like:


c39cc30375b80ea49217a9f313141eea.png

In the third test case, Alice shows Bob the bottom row, the whole grid may look like:


In the fourth test case, Alice shows Bob the top row, the whole grid may look like:


题目挺简单的,直接上代码。

 

#include <iostream>
using namespace std;
#define ll long long
char s[333];
signed main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    scanf("%s", s + 1);
    for (int i = 1; i <= n; i++) {
      if (s[i] == 'U') {
        printf("D");
        continue;
      }
      if (s[i] == 'D') {
        printf("U");
        continue;
      }
      printf("%c", s[i]);
    }
    printf("\n");
  }
}


相关文章
打印文档即提示Print driver host for 32bit applications
主机win7 32位系统,打印一切正常,共享打印机后,客户机为win7 64位系统连接该共享打印机,连接成功,驱动安装正常,x64驱动,客户机打印测试页正常,但打印文档即提示Print driver host for 32bit applications。
10050 0
打印文档即提示Print driver host for 32bit applications
|
开发工具 git
解决:‘git‘ 不是内部或外部命令,也不是可运行的程序
解决:‘git‘ 不是内部或外部命令,也不是可运行的程序
解决:‘git‘ 不是内部或外部命令,也不是可运行的程序
|
4月前
|
缓存 JSON 程序员
DeepSeek V4 Pro 正式版、Grok 4.6 同夜发布
DeepSeek V4 Pro 正式版(0813)与 Grok 4.6 同夜上线。跑分、价格、选型一次讲清,帮你判断主力 API 要不要换
DeepSeek V4 Pro 正式版、Grok 4.6 同夜发布
|
5月前
|
人工智能 缓存 自然语言处理
阿里云千问大模型Qwen3.7-Max产品介绍与便宜购买方案:免费试用、Token Plan订阅方案、5折特惠等
Qwen3.7-Max是阿里云千问系列面向智能体时代打造的国产旗舰大模型,在多项国际评测中位列国产第一、全球第五,具备顶尖编程推理能力、100万Token稳定长上下文、35小时超长自主执行与全模态融合等核心优势,适配开发者全栈开发、企业办公自动化、科研数据分析等多类高价值场景。本文梳理了五大低成本使用方案:新用户可领超7000万免费Tokens,百炼Token Plan分个人/企业多档位订阅,AI通用节省计划低至4.5折,模型调用限时5折,叠加专属优惠券还能享受折上折,覆盖从轻度体验到高频重度使用的全需求,帮助用户以极低门槛落地AI生产力。
|
4月前
|
人工智能 算法 定位技术
四大AI引擎引用源实测:2026年AI搜索优化窗口期判断与执行路径
本文基于2026年初对豆包、DeepSeek、Kimi、秘塔四大AI引擎的实测分析,揭示其引用源偏好差异,提出“平台推荐前置”新机制;首创5分钟窗口期自测法,并给出平台地图绘制、信息块拆解、内容版本适配三步执行路径,强调语义匹配与平台定制化运营。
550 0
|
5月前
|
人工智能 jenkins 测试技术
AI 测试必备:多Agent Skill 智能编排,从「脚本执行」到「失败自愈」到「报告生成」,一键跑通全流程!
`api-pipeline-scheduler`是接口自动化测试的“总指挥”,一键编排`执行→清理→报告`全链路,零改动原有Skill,支持4种模式与异常续跑,真正实现多Agent协同闭环,大幅提升测试效率与流水线标准化水平。
417 0
AI 测试必备:多Agent Skill 智能编排,从「脚本执行」到「失败自愈」到「报告生成」,一键跑通全流程!
|
存储 分布式计算 数据库
ETL vs ELT:到底谁更牛?别被名字骗了,这俩是两种世界观
ETL vs ELT:到底谁更牛?别被名字骗了,这俩是两种世界观
536 12
|
6月前
|
存储 缓存 安全
Ios云手机数据安全存储技术解析 2026 云端账号镜像加密指南
2026年云端账号托管安全风险凸显:低价服务频现缓存泄露、镜像复用、明文存储等问题。本文详解临时缓存、明文快照、私有加密对象存储三大架构差异,指出AES256端到端加密+设备级密钥隔离的方案,方能兼顾iOS合规性、环境稳定与隐私安全。(239字)
|
6月前
|
人工智能 监控 搜索推荐
同名混淆检测与结构化内容策略:个人GEO实验的系统架构实践
本文介绍“黄小宇”个人GEO实验:针对大模型同名混淆问题(如误认画家),构建可量化检测—归因—治理系统,通过结构化内容策略提升AI对真实身份的认知精度,探索AI时代个体可见度的科学建设路径。(239字)
|
8月前
|
弹性计算 监控 负载均衡
技术实践:使用阿里云ECS部署高可用Web应用架构
本文为阿里云云大使撰写的实战指南,详解如何用阿里云ECS搭建高可用电商应用:涵盖架构设计、环境部署、负载均衡、成本优化(月省27%)及故障处理。含完整脚本与性能数据,助力开发者高效上云。新用户通过链接享专属优惠👉https://www.aliyun.com/benefit?userCode=iakscw7s
810 13