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

0ms

Posted by xxxxx1234562 at 2010-07-28 16:06:30 on Problem 2853
#include "iostream"
using namespace std;

bool isInterger(double num)
{
	if(num-0.000001 < int(num))
		return true;
	else
		return false;
}
int main()
{
	
		int total;
		int n = 2;		//ÊýÁиöÊý 	
		double a1;			//ÊýÁÐÊ×Ïî
		cin>>total;
		while(total--)
		{
			int count =0;
			int index;
			cin>>index;

			double num;
			cin>>num;
			n=2;
			while(1)
			{
				if(n*(n-1)/2 >= num)		//a1*n+n*(n-1)/2 ÓÐÒ»²¿·ÖÒѾ­´óÓÚ¸ÃÊýÔòÌø³öÑ­»·
					break;

				a1 = (num - n*(n-1)/2)/n;
				if(isInterger(a1))		//¼ÙÈça1³ýÍêºóÊÇÕûÊý£¬Ôò¸ÃÁ¬Êý¿ÉÐÐ
				{
					count++;
				}
				n++;					
			}



			cout<<index<<" "<<count<<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