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 joecom at 2008-07-23 19:50:09 on Problem 1019
In Reply To:Re:求教高手,此题只能分组做么?有数学方法么? Posted by:fantasyorg at 2007-07-14 11:08:38
> 算出的结果正确 但总是WA
> #include<iostream>
> #include<cmath>
> using namespace std;
> 
> int main()
> {
> 	int times, find; 
> 	double answer, temp;
> 
> 	cin >> times;
> 
> 	for (int i = 0; i < times; i ++)
> 	{
> 		cin >> find;
> 
> 		answer = -0.5 + sqrt(0.0625 + find/2) * 2;
> 		 
> 		temp = int(answer);
> 		 
> 		if (answer - temp == 0)
> 			cout << temp << endl;
> 		else
> 			cout << find - (temp/2*temp + temp/2) << 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