zoukankan      html  css  js  c++  java
  • 【2017"百度之星"程序设计大赛

    【链接】http://bestcoder.hdu.edu.cn/contests/contest_showproblem.php?cid=777&pid=1001


    【题意】


    在这里写

    【题解】


    就是把一个数字复制了几次而已.
    而且不会出现有嵌套的情况.
    而且重复出现的次数都是个位数的.
    当成是在把字符串转化为数字这个过程去做就可以了.
    边转化,边取模就行。
    So easy啦

    【错的次数】


    0

    【反思】


    在这了写反思

    【代码】

    #include <bits/stdc++.h>
    using namespace std;
    #define lson l,m,rt<<1
    #define rson m+1,r,rt<<1|1
    #define LL long long
    #define rep1(i,a,b) for (int i = a;i <= b;i++)
    #define rep2(i,a,b) for (int i = a;i >= b;i--)
    #define mp make_pair
    #define pb push_back
    #define fi first
    #define se second
    #define ms(x,y) memset(x,y,sizeof x)
    #define ri(x) scanf("%d",&x)
    #define rl(x) scanf("%lld",&x)
    #define rs(x) scanf("%s",x+1)
    #define oi(x) printf("%d",x)
    #define ol(x) printf("%lld",x)
    #define oc putchar(' ')
    #define os(x) printf(x)
    #define all(x) x.begin(),x.end()
    #define Open() freopen("F:\rush.txt","r",stdin)
    #define Close() ios::sync_with_stdio(0)
    
    
    typedef pair<int,int> pii;
    typedef pair<LL,LL> pll;
    
    
    const int dx[9] = {0,1,-1,0,0,-1,-1,1,1};
    const int dy[9] = {0,0,0,-1,1,-1,1,-1,1};
    const double pi = acos(-1.0);
    const int N = 1000;
    const LL MOD = 1e9+7;
    
    
    char s[N+100];
    
    
    int main(){
        //Open();
        //Close();
        int T;
        ri(T);
        while (T--){
            rs(s);
            int len = strlen(s+1);
            LL ans = 0;
            rep1(i,1,len){
                char key = s[i];
                if (isdigit(s[i]))
                    ans = (ans*10 + key-'0')%MOD;
                else{
                    int j = i + 1;
                    while (s[j]!=')'){
                        ans = (ans*10+s[j]-'0')%MOD;
                        j++;
                    }
                    int temp = j + 3;
                    int num = s[temp]-'0';
                    rep1(TT,2,num){
                        rep1(k,i+1,j-1)
                            ans = (ans*10+s[k]-'0')%MOD;
                    }
                    i = j + 4;
                }
            }
            ol(ans);puts("");
        }
        return 0;
    }
    


  • 相关阅读:
    P2043 质因子分解
    CODE[VS] 3164 质因数分解
    借过
    CODE[VS] 1165 字符串的展开 || P1098 字符串的展开
    CODE[VS] 1144 守望者的逃离 || P1095 守望者的逃离
    CODE[VS] 2914 吹空调
    AC日记
    AC日记
    山科日记—回文
    山科日记—编写函数myFloor和myCeil(编程题)
  • 原文地址:https://www.cnblogs.com/AWCXV/p/7626090.html
Copyright © 2011-2022 走看看