Hust school competition Substring

Source: Internet
Author: User

Time Limit: 2 Sec Memory Limit: 64 MB
Submission: 251 Solved: 37
Description
This problem is quiet easy.
Initially, there is a string.
 
Then we do the following process infinity times.
A: = A + "HUSTACM" +
 
For example, if a = "X", then
After 1 step, A will become "XHUSTACMX"
After 2 steps, A will become "XHUSTACMXHUSTACMXHUSTACMX"
 
Let A = "X", Now I want to know the characters from L to R of the final string.

Input
Multiple test cases, in each test case, there are only one line containing two numbers L and R.
1 <= L <= R <= 10 ^ 12
R-L <= 100

Output
For each test case, you shocould output exactly one line which containing the substring.

Sample Input
5 10
Sample Output
TACMXH
HINT


Source
Problem Setter: Yang Xiao


Write a few to see the rule.

[Cpp]
# Include <stdio. h>
# Include <string>
# Include <iostream>
# Include <string. h>
Int a [1000];
Using namespace std;
Int main ()
{
_ Int64 left, right;
Char s [] = "XHUSTACM ";
While (scanf ("% I64d % I64d", & left, & right )! = EOF)
{
Left --; right --;
Int len = right-left + 1;
Puts (s );
Left = left % 8;
While (len --)
{
Printf ("% c", s [left]);
Left = (left + 1) % 8;
}
Printf ("\ n ");
}

Return 0;
}

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.