hust 1602, 乱搞
2013-11-07 18:41
423 查看
D - Substring
Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%lld & %llu
Submit Status Practice HUST 1602
Description
This problem is quiet easy.
Initially, there is a string A.
Then we do the following process infinity times.
A := A + “HUSTACM” + A
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 should output exactly one line which containing the substring.
Sample Input
Sample Output
Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%lld & %llu
Submit Status Practice HUST 1602
Description
This problem is quiet easy.
Initially, there is a string A.
Then we do the following process infinity times.
A := A + “HUSTACM” + A
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 should output exactly one line which containing the substring.
Sample Input
5 10
Sample Output
TACMXH
#include<iostream> #include<cstdio> #include<cstring> #include<string> #include<cmath> #include<vector> #include<cstdlib> #include<algorithm> using namespace std; #define LL long long #define ULL unsigned long long #define UINT unsigned int #define MAX_INT 0x7fffffff #define MAX_LL 0x7fffffffffffffff #define MAX(X,Y) ((X) > (Y) ? (X) : (Y)) #define MIN(X,Y) ((X) < (Y) ? (X) : (Y)) int main(){ // fstream fin("C:\\Users\\Administrator\\Desktop\\in.txt",ios::in); const char s[]="XHUSTACM"; LL l,r; while(cin>>l>>r){ LL i=0,len=strlen(s); LL j=(l-1)%len; for(i=0; i<r-l+1; i++){ printf("%c",s[j]); j=(j+1)%len; } printf("\n"); } // fin.close(); return 0; }
相关文章推荐
- HUST 1602 Substring
- hust 1602
- HUST 1602 (找规律)
- HUST 1602 Substring
- HUST 1602 - Substring
- HUST 1602 - Substring
- hust_1602 Substring
- hust 1022 K-diff subsequence
- hust 1524 Wedding
- hust NENU Summer Training 2014 #1 G - The Famous ICPC Team Again
- BZOJ 水题5连发 (1602 && 1603 && 1599 && 1651 &&1646)
- hust 1051 - Combination Lock
- hust 1342 - Cheat Secretly(有源汇有上下界的最小流)
- HUST_ACdream区域赛指导赛之手速赛系列(1)(2)D——数学——Triangles
- [ACM] HUST 1017 Exact cover (Dancing Links,DLX模板题)
- UVA1602 Lattice Animals 网格动物 (暴力,STL)
- 例题7-14 网格动物 UVa1602
- HUST 1341 A - A Simple Task(哈理工 亚洲区选拔赛练习赛)
- STC12C4052AD,4位数据总线驱动1602 LCD液晶屏,8位ADC功能,0--255级别
- HUST 1010 The Minimum Length