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 |
Re:这题怎么做啊?In Reply To:这题怎么做啊? Posted by:xh176233756 at 2007-02-22 17:20:47 #include <iostream> using namespace std; int sum (int n) { int sum1=0,i; for (i=1;i<=n;i++) { sum1=sum1+i; } return sum1; } int a[1000]; int main () { int k,i=0,j,sum2; cin>>k; while (k--) { cin>>a[i]; sum2=0; for (j=1;j<=a[i];j++) { sum2=sum2+j*sum(j+1); } cout<<i+1<<' '<<a[i]<<' '<<sum2<<endl; i++; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator