3003

3003

Problem C

Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65536/32768K (Java/Other)
Total Submission(s) : 86   Accepted Submission(s) : 35
Problem Description
Nowadays, a kind of chess game called “Super Jumping! Jumping! Jumping!” is very popular in HDU. Maybe you are a good boy, and know little about this game, so I introduce it to you now.<br><br><center><img src=/data/images/1087-1.jpg></center><br><br>The game can be played by two or more than two players. It consists of a chessboard(棋盘)and some chessmen(棋子), and all chessmen are marked by a positive integer or “start” or “end”. The player starts from start-point and must jumps into end-point finally. In the course of jumping, the player will visit the chessmen in the path, but everyone must jumps from one chessman to another absolutely bigger (you can assume start-point is a minimum and end-point is a maximum.). And all players cannot go backwards. One jumping can go from a chessman to next, also can go across many chessmen, and even you can straightly get to end-point from start-point. Of course you get zero point in this situation. A player is a winner if and only if he can get a bigger score according to his jumping solution. Note that your score comes from the sum of value on the chessmen in you jumping path.<br>Your task is to output the maximum value according to the given chessmen list.<br>
 

Input
Input contains multiple test cases. Each test case is described in a line as follow:<br>N value_1 value_2 …value_N <br>It is guarantied that N is not more than 1000 and all value_i are in the range of 32-int.<br>A test case starting with 0 terminates the input and this test case is not to be processed.<br>
 

Output
For each case, print the maximum according to rules, and one line one case.<br>
 

Sample Input
3 1 3 2 4 1 2 3 4 4 3 3 2 1 0
 

Sample Output
4 10 3
 
题意:
   两个人玩棋,根据不同的跳跃路径,最后得到的结果最大的人获胜。
   根本上来说就是求最大子序列的和的问题


思路:
   求最大子序列的和,就自然而然的想到动态规划问题;
   状态方程为:
   状态方程:sum[j]=max{sum[i]}+a[j]; 其中,0<=i<=j,a[i]<a[j] 


AC代码:
  #include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;


int a[1005],dp[1005];
const int inf = 999999999;


int main()
{
    int n,i,t,m,j,ans;
    while(~scanf("%d",&n),n)
    {
        memset(dp,0,sizeof(dp));
        for(i = 1;i<=n;i++)
        scanf("%d",&a[i]);
        for(i = 1;i<=n;i++)
        {
            ans = -inf;
            for(j = 0;j<i;j++)
            {
                if(a[i]>a[j])
                ans = max(ans,dp[j]);
            }
            dp[i] = ans+a[i];
        }
        ans = -inf;
        for(i = 0;i<=n;i++)
        {
            if(dp[i]>ans)
            ans = dp[i];
        }
        printf("%d\n",ans);
    }


    return 0;
}



<think>好的,我需要处理用户关于GC3003的错误代码或技术文档的查询。首先,我需要确认GC3003是什么类型的错误,可能属于内存溢出、垃圾回收问题,或者其他系统错误。 根据用户提供的引用内容,引用[1]提到了Java内存模型中的内存泄漏和永久代溢出(PermGen space),这可能与GC(垃圾回收)有关。GC3003可能是一个特定的垃圾回收错误代码,但常见的错误如OutOfMemoryError有不同的类型,如堆溢出、永久代溢出等。需要确认GC3003是否属于这些类别中的某一种,或者是否是某些框架或工具特有的错误代码。 用户还提到参考了高并发解决方案的文档,引用[2]中有关于性能测试和调优的内容,这可能与系统在高负载下出现的GC问题相关。因此,GC3003可能是在高并发环境下触发的垃圾回收问题,需要结合系统负载和配置来分析。 接下来,我需要检查是否有公开的技术文档或社区讨论提到GC3003。由于常见的Java错误通常以Exception或Error类型命名,如OutOfMemoryError,而GC3003看起来像是由特定系统或工具生成的错误代码。可能需要考虑是否是应用服务器(如WebLogic、WebSphere)、监控工具(如GC日志分析工具)或APM(应用性能管理)系统中的代码。 建议用户检查完整的错误日志,包括错误消息的上下文,以确定错误来源。例如,如果是垃圾回收相关的日志,可能需要分析GC日志文件,使用工具如GCViewer或GCEasy来分析。此外,检查应用服务器的文档或支持页面,看是否有关于GC3003的具体说明。 如果GC3003与内存泄漏有关,如引用[1]所述,可以使用内存分析工具(如Eclipse MAT)来查找未被释放的对象,查看它们的引用链,从而定位泄漏源头。对于高并发场景,引用[2]中的调优建议,如增加堆内存、调整GC算法(如G1 GC),可能有助于缓解问题。 最后,考虑到用户可能需要进一步的帮助,生成相关问题可以引导他们提供更多细节或探索相关解决方案。</think>关于GC3003技术信息/错误代码的分析与建议: 根据您提供的引用内容和GC3003的编码特征,目前可确认以下信息: 1. **可能关联方向分析** - **垃圾回收机制**:引用[1]中提到的内存泄漏和PermGen溢出属于GC问题范畴,GC3003可能与特定GC机制相关 - **高并发场景**:引用[2]中的性能压测方案显示,该代码可能出现在高并发场景下的系统异常 - **编码结构解析**:GC前缀通常代表"Garbage Collection"或"Global Catalog",3003可能是具体错误编号 2. **排查建议步骤** ```bash # 查看完整错误日志(示例命令) grep 'GC3003' /var/log/app/system.log --color -A10 -B10 # JVM内存分析命令 jstack <pid> > thread_dump.txt jmap -histo:live <pid> > heap_analysis.txt ``` 3. **临时解决方案** - 调整JVM参数(参考引用[1]): ```java -XX:+HeapDumpOnOutOfMemoryError -XX:PermSize=256m -XX:MaxPermSize=512m ``` - 使用内存分析工具检查引用链(Eclipse MAT)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值