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> using namespace std; int main () { int n,k[999]; cin>>n; for (int i=0;i<n;i++) { cin>>k[i]; int w=0; for (int j=1;j<=k[i];j++) { w+=j*(j+1)*(j+2)/2; } cout<<i+1<<" "<<k[i]<<" "<<w<<endl; } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator