关于pat上1007 Maximum Subsequence Sum(求最大子列)部分正确

 #include<string>
#include<vector>
#include<sstream>
#include<iostream>
using namespace std;

vector<int>dic;
int main(){
  int a,sum=0,star=0,star1=0,fina=0,n=0,now=0;
  bool t=true;
  string b,c;
 getline(cin,b);
 getline(cin,b);
 stringstream ss(b);

 while(ss>>a){
        now+=a;
    if(now<0)
    {now=0;t=true;}
    if(now>0){
        if(t){
        star1=n;t=false;}
        if(sum<now){
            sum=now;fina=n;
            star=star1;
        }}
        n++;//cout<<a<<endl;
 }
 cout<<sum;
 if(sum!=0)
        cout<<' '<<star<<' '<<fina;
        else cout<<' '<<star<<' '<<n-1;
    }

总是部分正确.求解答.
图片说明

我也是这样仔细读下题吧:Now you are supposed to find the largest sum, together with the first and the last numbers of the maximum subsequence.