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

Re:看看还能比这个简单么? 我瞎蒙的....

Posted by QuickLink at 2010-01-25 12:27:34 on Problem 1032
In Reply To:看看还能比这个简单么? 我瞎蒙的.... Posted by:jessekidddd at 2006-01-18 12:25:59
> #include <iostream.h>
> int main(int argc, char *argv[])
> {
>     int n=7,i,t;
>     cin>>n;
>     for(i=2;n>=i;i++) n-=i;
>     i--;//原来多加了一个1
>     if(i==n)
>     {
>         for(t=2;t<=i-1;t++)
>     	{
>     	   cout<<t+1<<" ";
>         }
>         cout<<i+2<<" ";
>     }
>     else
>     {
>         for(t=2;t<=i;t++)
>         {
> 	       if(i-t<n) cout<<t+1<<" ";
> 	       else cout<<t<<" ";
>         }
>     }
>     cout<<endl;
> 	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