Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
求教代码如下: #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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator