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

真是服了 cout 和printf换换样就不对了 c++又不支持cout<<了吗?真是的

Posted by 0712105003 at 2009-10-16 14:25:20 on Problem 2000
#include<iostream>
#include<memory.h>
using namespace std;
__int64 num[11000];
int main()
{
    int i,n,j;
    int temp=0;
    memset(num,0,sizeof(num));
    for(i=1;i*(i-1)/2<11000;i++)
    {
        temp=(i-1)*i/2;
        for(j=1;j<=i;j++)
        {
            num[temp+j]=i+num[temp+j-1];
        }
    }
    for(temp=temp+i-1;temp<11000;temp++)
        num[temp]=i+num[temp-1];
    //for(i=1;i<30;i++)
  //      cout<<num[i]<<" ";
    while(scanf("%d",&n)&&n)
    {
//        cout<<n<<" "<<num[n]<<endl;
printf("%d %d\n",n,num[n]);
    }
    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