#GD0000164. Nhà thần số học kỳ lạ (The Mad Numerologist)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Nhà thần số học kỳ lạ (The Mad Numerologist)
The Mad Numerologist
Source: UVa
Version: Phuoc Hung OJ Extended
Problem Statement
Construct an uppercase name of length . Odd positions must contain vowels (A,E,I,O,U), each used at most times, and even positions must contain consonants, each used at most times. Letter weights follow alphabet positions modulo (A,J,S weigh , B,K,T weigh , ..., I,R weigh ). Minimize the total vowel weight and the total consonant weight separately; among optimum names output the lexicographically smallest.
Input
One line contains the required name length .
Output
Print one uppercase name of length satisfying the position limits, usage caps, minimum total weights, and lexicographic tie-break. The PHOJ version does not include a multi-case label.
Subtasks
- Subtask 1 (20 points): ; nguyên âm tối đa lần/chữ; phụ âm tối đa lần/chữ.
- Subtask 2 (30 points): ; nguyên âm tối đa lần/chữ; phụ âm tối đa lần/chữ.
- Subtask 3 (50 points): ; nguyên âm tối đa lần/chữ; phụ âm tối đa lần/chữ.
Examples
Input
5
Output
AJAJA
Explanation
A length- name has three vowel positions and two consonant positions. Three A letters and two J letters each have weight , producing the minimum weights and the lexicographically smallest interleaving AJAJA.