HUST 1602 Substring

水题。

#include<cstdio>
#include<cstring>
#include<cmath>
#include<string>
#include<algorithm>
using namespace std;

long long L, R;
string Q = "XHUSTACM";

int main()
{
    while (~scanf("%lld%lld", &L, &R))
    {
        long long tot = R - L + 1;
        long long st = L % 8;
        if (st == 0) st = 8;

        long long now = 0;
        while (1)
        {
            printf("%c", Q[st-1]);
            now++;
            if (now == tot) break;
            st++;
            if (st == 9) st = 1;
        }
        printf("\n");

    }
    return 0;
}

 

posted @ 2016-03-07 08:29  Fighting_Heart  阅读(124)  评论(0编辑  收藏  举报