Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

求教

Posted by ch_619999 at 2007-09-24 19:56:52 on Problem 1163
代码如下:
#include<iostream>
#include<string>
using namespace std;
int main()
{
    long long int n,i,j,k,c,d;
    long long int s;
    int a[200][200],b[200][200];
    cin>>n;
    k=1;
    //赋初值 
    for(i=0;i<n;i++)
    {
        for(j=0;j<k;j++)
        {
             cin>>a[i][j];
             b[i][j]=a[i][j];
        }
            
        k++;
    }
    //肖行 
    for(i=0;i<n-1;i++)
         for(j=0;j<n-i-1;j++)
         {
             a[n-2-i][j]+=a[n-1-i][j]+a[n-1-i][j+1];
             
            cout<<a[n-2-i][j]<<" ";
         }
    //求和  
    s=b[0][0];c=0;
    for(i=1;i<n;i++)
    {
        d=c;
        k=a[i][d];
        for(j=d;j<d+2;j++)
        if(a[i][j]>k)
        {
            k=a[i][j];
            c=j;
        }
        s+=b[i][c];
        //cout<<s<<" "<<c<<endl;
    }
    cout<<s;
    return 0;
    
}
为什莫错误啊















Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator