Decreasing StringProblem code: DECSTR |
All submissions for this problem are available.
Statement
Consider a string of length N consisting only of lowercase alphabets a-z. Let s[i] be the character at the i-th position in the string (1-based). The string is a K-string if there are EXACTLY K values of i (1 <= i < N) such that s[i+1]<s[i] (we assume 'a'<'b'<'c'<...<'z'). Given K, find the shortest K-string. If there are multiple solutions, find the lexicographically earliest K-string.
Input
The first line contains the number of test cases T (1<= T <= 100). Each test case contains an integer K (≤ 100).
Output
Output T lines, one for each test case, containing the required string. Use only lower-case letters a-z.
Sample Input
2 1 2
Sample Output
ba cba
| Date: | 2010-09-10 |
| Time limit: | 1s |
| Source limit: | 50000 |
| Languages: | C C99 strict C++ 4.0.0-8 C++ 4.3.2 PAS gpc PAS fpc JAVA NICE JAR C#2 NEM ST ASM D FORT ADA BASH PERL PYTH RUBY LUA ICON PIKE PHP SCM guile SCM qobi LISP sbcl LISP clisp SCALA HASK ERL CAML CLPS PRLG WSPC BF ICK JS |
Comments

Fetching successful submissions

I am unable to submit
I am unable to submit solution of this problem, it says restricted content... please fix the technical issues
@Saurajeet: You need to log
@Saurajeet: You need to log in with your team name to submit. You cannot submit with your userid. It has to be team id.
I cannot submit my
I cannot submit my solution.
This is my second submission.
Are we allowed only one submission?
how to submit code
how to submit code
@ocxorg: What is the error
@ocxorg: What is the error that you are getting?
@rakesh: you need to login with team credentials and then submit. Is there any issue that you are facing?
it asks for the contest id <
it asks for the contest id < where to give it
@admin:where to give the
@admin:where to give the contest_problem_id?
it asks for a
it asks for a contest_problem_id ?
@rakesh: When is it giving
@rakesh: When is it giving you this error?