注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

Minary_Acdream

http://f10.moe/

 
 
 

日志

 
 

[NBUT] 1181 Big Mouth of Abyss - Kog'Maw  

2012-07-11 18:57:30|  分类: NBUT 2012 Summer |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
  • 问题描述
  • [NBUT] 1181 Big Mouth of Abyss - KogMaw - Minary - Minary_Acdream
     
    The game LOL is an interesting game. Recently we are playing this game. Once I used a champion named Kog'Maw - The Mouth of the Abyss.
    For I have to support teammate, I only have a little time to do the last hit to kill the enemy's minions.
    There're N (2 <= N <= 10000) minions, each minion has a threat value TVi (1 <= TVi <= 9).
    And there's a formula to calculate the total threat value:



    I only can kill K (1 <= K < N) minions.
    When I kill one minion, the minions after it will move to front for one step. It means when I kill Minion[5], then Minion[6] will be Minion[5] and Minion[7] will be Minion[6] and so on.
    How to kill the minions that I can leave the minimum total threat value?
  • 输入
  • This problem contains several cases.
    Each case contains two numbers. The first number T is the total threat value at the very beginning (1 <= T < 10^10001). Then follows an integer K, means the number that minions I can kill.
  • 输出
  • For each case, you should output the minimum total threat value after I kill K minions.
  • 样例输入
  • 123456 4 3212311 4 
  • 样例输出
  • 12 111 

    题目绕了半天的意思其实就是求前面一个数据T去掉K位数后的最小值。
    我们条件性的认为从最高位去掉比后几位大的数就好了。
    下面是代码:

    #include<iostream>
    #include<string>

    using namespace std;

    int main()
    {
    string str;
    int n;
    while(cin>>str>>n)
    {

    for(int i = 0;i < n;i ++)
    {
    for(int j = 0;j < str.size();j ++)
    {
    if(j == str.size() - 1 || str[j] > str[j + 1])
    {
    str.erase(str.begin()+ j);
    break;
    }
    }
    }
    cout<<str<<endl;
    }
    return 0;
    }


  评论这张
 
阅读(73)| 评论(2)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018