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;
}