【链接】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;
}

【2017"百度之星"程序设计大赛 - 复赛】Arithmetic of Bomb的更多相关文章

  1. 2017百度之星程序设计大赛 - 复赛 Arithmetic of Bomb

    http://acm.hdu.edu.cn/showproblem.php?pid=6144 解法:一个简单的模拟 #include <bits/stdc++.h> using names ...

  2. 2017"百度之星"程序设计大赛 - 复赛1001&&HDU 6144 Arithmetic of Bomb【java大模拟】

    Arithmetic of Bomb Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Other ...

  3. 2017"百度之星"程序设计大赛 - 复赛 01,03,05

    Arithmetic of Bomb Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Other ...

  4. 2017"百度之星"程序设计大赛 - 复赛1005&&HDU 6148 Valley Numer【数位dp】

    Valley Numer Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Tota ...

  5. 2017"百度之星"程序设计大赛 - 复赛1003&&HDU 6146 Pokémon GO【数学,递推,dp】

    Pokémon GO Time Limit: 3000/1500 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total ...

  6. [SinGuLaRiTy] 2017 百度之星程序设计大赛 复赛

    [SinGuLaRiTy-1038] Copyright (c) SinGuLaRiTy 2017. All Rights Reserved. Arithmetic of Bomb Problem D ...

  7. 2017"百度之星"程序设计大赛 - 复赛

    Arithmetic of Bomb  Accepts: 1050  Submissions: 1762  Time Limit: 2000/1000 MS (Java/Others)  Memory ...

  8. 【2017百度之星程序设计大赛 - 复赛】Valley Numer

    [链接]http://acm.hdu.edu.cn/showproblem.php?pid=6148 [题意] 在这里写题意 [题解] 先把1..N里面的山峰数字个数算出来->x 然后用N减去这 ...

  9. HDU 6118 度度熊的交易计划 【最小费用最大流】 (2017"百度之星"程序设计大赛 - 初赛(B))

    度度熊的交易计划 Time Limit: 12000/6000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total S ...

随机推荐

  1. Python列表插入字典(转)

    https://blog.csdn.net/qq_29721419/article/details/70310183

  2. Network Stack‎ : CookieMonster

    CookieMonster   The CookieMonster is the class in Chromium which handles in-browser storage, managem ...

  3. mysql中group by和order by混用 结果不是理想结果

    在使用mysql排序的时候会想到按照降序分组来获得一组数据,而使用order by往往得到的不是理想中的结果,那么怎么才能使用group by 和order by得到理想中的数据结果呢? 例如 有一个 ...

  4. linux 查看tomcat 实时日志

    进入tomcat下logs文件夹下,若没有Catalina.out文件先去启动服务在回到logs文件夹输入 tail -f catalina.out ,可看到实时日志

  5. Safe and efficient allocation of memory

    Aspects of the present invention are directed at centrally managing the allocation of memory to exec ...

  6. PatentTips - Virtual translation lookaside buffer

    BACKGROUND OF THE INVENTION A conventional virtual-machine monitor (VM monitor) typically runs on a ...

  7. Linux中配置网桥

    使用kvm虚拟机时,有时候需要自己添加网桥供guest使用. 不使用libvirt来管理的话,可以使用以下方法创建网桥并绑定到物理网卡(RHEL6/Fedora已实验): 1.创建网桥配置文件ifcf ...

  8. 自己写unicode转换ascii码,wchar*到char*

    对于ascii码的char事实上就是unicode码wchar的首个字节码, 如wchar[20] = "qqqq"; 在内存中排码事实上是char的'q' '\0'这类.因此我们 ...

  9. LeetCode102 Binary Tree Level Order Traversal Java

    题目: Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to ri ...

  10. Android 学习笔记之Bitmap位图的缩放

    位图的缩放也可以借助Matrix或者Canvas来实现. 通过postScale(0.5f, 0.3f)方法设置旋转角度,然后用createBitmap方法创建一个经过缩放处理的Bitmap对象,最后 ...