国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

HDU - 1087

2019-11-08 03:09:12
字體:
來源:轉載
供稿:網友
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.
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.Your task is to output the maximum value according to the given chessmen list. InputInput contains multiple test cases. Each test case is described in a line as follow:N value_1 value_2 …value_N It is guarantied that N is not more than 1000 and all value_i are in the range of 32-int.A test case starting with 0 terminates the input and this test case is not to be PRocessed.OutputFor each case, print the maximum according to rules, and one line one case. Sample Input
3 1 3 24 1 2 3 44 3 3 2 10Sample Output

4103

#include<stdio.h>main(){    int nax,mmax,i,l,n,qian1[1050],qian2[1050];//qian1數組用來存儲輸入的每個數值,qian2數組用來存儲到達當前位置走過的數值之和的最大值    while(scanf("%d",&n)&&n!=0)    {        mmax=0;        for(i=0;i<n;i++)        {scanf("%d",&qian1[i]);qian2[i]=qian1[i];}        for(i=0;i<n;i++)        {            nax=qian2[i];            for(l=0;l<i;l++)            {            if(qian1[l]<qian1[i]&&qian2[l]+qian1[i]>nax)            nax=qian1[i]+qian2[l];            qian2[i]=nax;            }            if(mmax<nax)                mmax=nax;        }printf("%d/n",mmax);    }}


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 靖宇县| 策勒县| 大兴区| 大港区| 东光县| 阿克| 来凤县| 张掖市| 城口县| 上饶县| 尼木县| 齐河县| 沽源县| 顺义区| 广德县| 皮山县| 吉木萨尔县| 辽中县| 江陵县| 乐陵市| 泽州县| 二手房| 西贡区| 临泉县| 西吉县| 聂荣县| 扶沟县| 太原市| 博兴县| 成都市| 多伦县| 泸州市| 大姚县| 盐山县| 贵州省| 佳木斯市| 宜兴市| 彭水| 武平县| 方正县| 盈江县|