`
carmark
  • 浏览: 160885 次
  • 性别: Icon_minigender_1
  • 来自: 大连->北京
社区版块
存档分类
最新评论

1036 Gangsters

阅读更多
#include <iostream.h> 
void main() 
{ 
    int n,k,time,i,j,max,ii,temp; 
    int t[100],p[100],s[100],a[2][101]; 
    cin>>n>>k>>time; 
    for(i=0;i<n;i++) 
        cin>>t[i]; 
    for(i=0;i<n;i++) 
        cin>>p[i]; 
    for(i=0;i<n;i++) 
        cin>>s[i]; 
    for(j=0;j<=k;j++) 
    { 
        a[0][j]=0; 
    } 
    for(i=0;i<n-1;i++) 
        for(j=i+1;j<n;j++) 
            if (t[i]>t[j]) 
            { 
                temp=t[i]; 
                t[i]=t[j]; 
                t[j]=temp; 
                temp=s[i]; 
                s[i]=s[j]; 
                s[j]=temp; 
                temp=p[i]; 
                p[i]=p[j]; 
                p[j]=temp; 
            } 
    ii=1;temp=0; 
    while (t[temp]==0) 
        temp++; 
    for(i=1;i<=time&&temp<n;i++) 
    { 
        for(j=0;j<=k;j++) 
        { 
            a[ii][j]=0; 
            if (j>0&&a[1-ii][j-1]>a[ii][j]) a[ii][j]=a[1-ii][j-1]; 
            if (a[1-ii][j]>a[ii][j]) a[ii][j]=a[1-ii][j]; 
            if (j<k&&a[1-ii][j+1]>a[ii][j]) a[ii][j]=a[1-ii][j+1]; 
        } 
        while (temp<n&&t[temp]==i) 
        { 
            if(s[temp]<=i) 
                a[ii][s[temp]]+=p[temp]; 
            temp++; 
        } 
        ii=1-ii; 
    } 
    max=0; 
    for(i=0;i<=k;i++) 
        if(max<a[1-ii][i]) max=a[1-ii][i]; 
    cout<<max<<endl; 
} 

分享到:
评论

相关推荐

    Economic Gangsters

    Chapter One Fighting For Economic Development 1 Chapter Two Suharto, Inc. 22 Chapter Three The Smuggling Gap 53 ...Learning to Fight Economic Gangsters 186 Epilogue Doing Better This Time 207

    Grand Gangsters 3D 大BOSS Unity侠盗之城竞速射击项目源码C#

    Grand Gangsters 3D 大BOSS Unity侠盗之城竞速射击项目源码C# 支持Unity版本2019.4.40f1及以上 欢迎来到侠盗之城!一切开始的地方。今天就在《大BOSS》的圣安德烈亚斯断层中开启一次危险的全新城市之旅! 《大黑帮》...

    BN-Gangsters

    BN-Gangsters

    British Gangsters Pack - Museum v1.0.unitypackage

    British Gangsters Pack - Museum v1.0

    gang:Node.js 的进程间通信、PubSub 消息传递和 Web 代理进程协作网格库

    * - listen for publications from gangsters on subAddress * - proxy http connections requests to httpAddress : httpPort */var alley = require ( 'gang' ) . alley ( { subAddress : 'tcp://127.0.0.1:8990'...

    新概念必背(三20篇,四16篇)

    此外,“If the money was not paid promptly, the gangsters would quickly put a man out of business”展示了条件句的使用,以及动词短语“put out of business”的含义——使某人破产。 文章还涉及到时间和年龄...

    PPT模板-模板20.pptx

    6. **团队介绍(YOUR GANGSTERS)**:展示团队成员的照片和个人简介,可以增加观众对你的信任度。每个团队成员的描述应简明扼要,突出他们的专业技能和成就。 7. **服务展示(WE OFFER THE BEST SERVICES)**:用...

    2012职称英语+精选词汇表

    例如:“The gangsters were involved in illegal activities such as drug trafficking.”(这些歹徒参与了贩毒等非法活动。) ##### 38. **hard** (艰苦) - **解析:** 艰难困苦的。例如:“Life in the ...

Global site tag (gtag.js) - Google Analytics