| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:求教高手,此题只能分组做么?有数学方法么?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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator