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 fantasyorg at 2007-07-14 11:03:50 on Problem 1019
#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