1.初始构造一颗单链树,依次把底部的节点放入上面的层,直到满足深度总和为d 2.若当前深度总和sum > d,则先拿掉底端节点。 拿掉后,若sum依然比d大,就直接把底端节点放入有空位的最上层; 拿掉后sum <= d,dif = d - sum。 若dif >= 此时有空位的最上层深度,则深度为dif的层一定有空位,把底端节点放入该...
Codeforces Round #634 B. Construct the String(贪心) 题目描述 You are given three positive integers n n n , a a a and b b b . You have to construct a string s s s of length n n n consisting of lowercase Latin letters such that each substring of length a a a has exactly b b ...
It is guaranteed that the sum ofnn over all test cases does not exceed20002000 (∑n≤2000∑n≤2000). Output For each test case, print the answer — such a stringss of lengthnn consisting of lowercase Latin letters thateach substring of lengthaa hasexactlybb distinct letters. If there are...
It is guaranteed that the sum ofnn over all test cases does not exceed20002000 (∑n≤2000∑n≤2000). Output For each test case, print the answer — such a stringss of lengthnn consisting of lowercase Latin letters thateach substring of lengthaa hasexactlybb distinct letters. If there are...