#QHD0000021. Trọng lượng của từ (The Weight Of Words)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Trọng lượng của từ (The Weight Of Words)
The Weight Of Words
Source: Kattis
Version: Phuoc Hung OJ Extended
Problem Statement
Each lowercase English letter has a weight: a weighs , b weighs , and so on through z, which weighs . The weight of a word is the sum of its letters’ weights.
Given and , construct a word consisting only of lowercase English letters, with exactly characters and total weight exactly .
Print any valid word, or impossible if no such word exists.
Input
One line contains the integers and , the required word length and total weight.
Output
Print any valid lowercase word, or exactly impossible if none exists.
Subtasks
- Subtask 1 (20 points): ; .
- Subtask 2 (30 points): ; .
- Subtask 3 (50 points): ; .
Examples
Input
7 96
Output
zzzoaaa
Explanation
The word zzzoaaa has letters. Three z letters contribute , o contributes , and three a letters contribute . The weight is . Any other valid word would also be accepted.