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 |
这个也runtime ?#include<iostream> using namespace std; int main() { int a[10000]; int i,j,k,n; //freopen("a.in","r",stdin); //freopen("a.out","w",stdout); j=1;k=1;a[0]=0; for (i=1;i<=10000;i++) { a[i]=a[i-1]+k; if (j==i) { k++; j+=k; } } while (cin>>n && n!=0) cout<<n<<" "<<a[n]<<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