QOJ.ac

QOJ

実行時間制限: 4.0 s メモリ制限: 1024 MB 満点: 100

#10267. 构造 uwu

統計

给定一个正整数 $N$。

构造一个仅由字母 'u' 和 'w' 组成的最小长度字符串 $S$,满足以下条件: * $S$ 中等于 "uwu" 的子序列数量恰好为 $N$。注意,子序列不需要是连续的。

可以证明至少存在一个合法的字符串。你需要为每个测试用例找到最短的字符串。输入数据的生成方式保证所有测试用例中最小字符串长度之和不超过 $10^7$。

输入格式

  • 第一行包含一个整数 $T$,表示测试用例的数量。
  • 每个测试用例仅包含一行,即所需的子序列数量 $N$。

输出格式

对于每个测试用例,输出一个长度最小且包含恰好 $N$ 个 "uwu" 子序列的字符串 $S$。

数据范围

  • $1 \le T \le 10^3$
  • $1 \le N \le 10^{18}$
  • 所有测试用例中最小字符串长度之和不超过 $10^7$。

样例

样例输入 1

6
1
2
3
4
5
6

样例输出 1

uwu
uwwu
uwwwu
uwwuu
uwwwwwu
uwwwuu

说明

测试用例 1:"uwu" 恰好有一个等于 "uwu" 的子序列,即字符串本身。

测试用例 2:"uwwu" 有 2 个等于 "uwu" 的子序列(使用 1-based 索引): 由索引 $(1, 2, 4)$ 组成的子序列。 由索引 $(1, 3, 4)$ 组成的子序列。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.