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

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

HDU-1003

2019-11-08 03:02:08
字體:
來源:轉載
供稿:網友

http://acm.hdu.edu.cn/showPRoblem.php?pid=1003

#include <iostream>#include <stdio.h>#include<algorithm>#include <string.h>using namespace std;int main(){    int T;    cin>>T;    int CASE=1;    while(T--){        int n;        cin>>n;        int i,j;        int sum=0;        int ans=-10000;        int temp=0;        int  pos1=0,pos2=0;        for(i=0;i<n;i++){            int t;            scanf("%d",&t);            sum+=t;             if(sum>ans){                ans=sum;                pos1=temp;                pos2=i;            }            if(sum<0){                sum=0;                temp=i+1;            }        }        cout<<"Case "<<CASE++<<":"<<endl;       // cout<<ans<<" "<<pos1+1<<" "<<pos2+1<<endl;        printf("%d %d %d/n",ans,pos1+1,pos2+1);        if(T>0)cout<<endl;    }    return 0;}


上一篇:可見性

下一篇:類型轉換

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 同江市| 湖口县| 道孚县| 卓尼县| 名山县| 玉门市| 静宁县| 安溪县| 清镇市| 油尖旺区| 江陵县| 阳原县| 吉林省| 山东| 石泉县| 固原市| 巴塘县| 周宁县| 黔西| 垫江县| 忻州市| 宜君县| 白山市| 湖南省| 云南省| 二连浩特市| 收藏| 保定市| 台中县| 新营市| 惠州市| 江山市| 南皮县| 苍溪县| 枞阳县| 翁源县| 农安县| 阳信县| 汝城县| 南木林县| 宣化县|