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

低调~

Posted by niuliguo at 2009-11-03 22:41:36 on Problem 2853
In Reply To:超水!! 0MS就ok 代码共享 Posted by:z1160y at 2009-05-23 01:52:54
#include<iostream>
using namespace std;
int main()
{int m,n,k,N;
 cin>>N;
 for(int l=1;l<=N;l++)
 {cin>>k>>m;
  for(int i=1;;i++)
  {if(m>=(i+1)*i/2&&m<(i+2)*(i+1)/2 )  {n=i;break;}
   }
 int t=0;
 for(int j=2;j<=n;j++)
 {if(  (2*m-(j-1)*j)%(2*j)==0  )   t++;
 }
 cout<<k<<" "<<t<<endl;
}
 system("pause");
 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