题目链接:https://codeforces.com/contest/1384/problem/A

题意

构造 $n+1$ 个字符串,使得 $n$ 对相邻字符串的相同前缀长度对应于数组 $a$ 。

题解

构造一个足够长的字符串,每次反转前缀不同处的字符即可。

代码

#include <bits/stdc++.h>
using namespace std; void solve() {
int n; cin >> n;
string s(200, 'a');
cout << s << "\n";
for (int i = 0; i < n; ++i) {
int j; cin >> j;
s[j] = (s[j] == 'a' ? 'b' : 'a');
cout << s << "\n";
}
} int main() {
int t; cin >> t;
while (t--) solve();
}

最新文章

  1. 初识NodeJS
  2. [函數] Firemonkey 各平台 &quot;简体&quot; / &quot;繁体&quot; 判断
  3. ThreadPoolExecutor 分析
  4. Linux基本配置
  5. 读取Cookie及Cookie所有属性操作方法
  6. android的jni
  7. ZOJ 3490 String Successor
  8. OC——动态添加Button和监听UIAlertView按钮
  9. PipedInputStream/PipedOutputStream原理
  10. linux内核升级(ubuntu12.04从3.13.0升级到3.4.0 )
  11. centos7 yum相关的常用命令
  12. 关于redis分布式锁的实现方式(转载)
  13. python 学习三
  14. WPF:TreeView绑定
  15. Django之转发和重定向
  16. 『翻译』Access USB Devices on the Web
  17. 替换Jar包内的文件
  18. linux shell 脚本攻略学习20--awk命令入门详解
  19. Specular Aliasing与Specular Leaking
  20. Redis常用指令

热门文章

  1. Vue.nextTick()的使用
  2. Linux调整lvm逻辑分区大小
  3. 2020周阳SpringCloud完整版笔记--一
  4. Java多线程-锁的区别与使用
  5. Netty入门一:服务端应用搭建 &amp; 启动过程源码分析
  6. JS navigator.userAgent
  7. Linux Shell 编程基础详解——吐血整理,墙裂推荐!
  8. oracle释放空间到OS
  9. 【一天一个知识点系列】- Redis Cluser之数据分布
  10. Sentry(v20.12.1) K8S 云原生架构探索,JavaScript 性能监控之管理 Transactions