最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

CF 1774A - Add Plus Minus Sign

2023-08-18 14:22 作者:您是打尖兒還是住店呢  | 我要投稿

AquaMoon has a string a consisting of only 0 and 1. She wants to add + and ? between all pairs of consecutive positions to make the absolute value of the resulting expression as small as possible. Can you help her?


Input

The first line contains a single integer t (1≤t≤2000)? – the number of test cases. The description of test cases follows.

The first line of each test case contains a single integer n (2≤n≤100) — the length of a.

The second line of each test case contains a string a of length n, consisting of only 0 and 1.

Output

For each test case, output a string of length n?1 consisting of ? and + on a separate line. If there is more than one assignment of signs that produces the smallest possible absolute value, any of them is accepted.

Example

--------------------------------------

AquaMoon 有一個僅由 0 和 1 組成的字符串 a。她想在所有連續(xù)位置對之間添加 + 和 ?,以使結(jié)果表達(dá)式的絕對值盡可能小。 你能幫助她嗎?


輸入

第一行包含一個整數(shù) t (1≤t≤2000) – 測試用例的數(shù)量。 測試用例的描述如下。

每個測試用例的第一行包含一個整數(shù) n (2≤n≤100) — a 的長度。

每個測試用例的第二行包含一個長度為n的字符串a(chǎn),僅由0和1組成。

輸出

對于每個測試用例,在單獨的行上輸出一個長度為 n?1 的字符串,其中包含 - 和 +。 如果存在多個產(chǎn)生最小可能絕對值的符號分配,則接受其中任何一個。

例子

------------------------

目的是和最小,當(dāng)是奇數(shù)的時候,可以加,當(dāng)時偶數(shù)的時候就減,即可;

下面是代碼;


CF 1774A - Add Plus Minus Sign的評論 (共 條)

分享到微博請遵守國家法律
泰和县| 阿鲁科尔沁旗| 林口县| 隆林| 桐城市| 历史| 古丈县| 桃园市| 江油市| 中江县| 剑阁县| 道真| 安丘市| 布拖县| 咸宁市| 延川县| 华安县| 汨罗市| 溧阳市| 东乌珠穆沁旗| 三原县| 广南县| 高要市| 乐安县| 德兴市| 昌宁县| 新沂市| 沐川县| 通榆县| 图木舒克市| 通河县| 克东县| 宜兴市| 彰化市| 东乌珠穆沁旗| 扶余县| 高邮市| 澄江县| 油尖旺区| 牙克石市| 平昌县|