UVA - 10217 A Dinner with Schwarzenegger!!!

A Dinner with Schwarzenegger !!!
Input: Standard Input
Output: Standard Output
Time Limit: 2 seconds

 

One of your friends informed you that a nearby theater in your city has given a new offer. It will show the super hit Schwarzenegger movie “Terminator 2”. While selling ticket they will keep record of the buyers' birthdays. If someone’s birthday matches the birthday of a person who has bought ticket before him, he (the one who bought ticket later) will be given the honor to have dinner with Schwarzenegger. To give the guy at the front of the queue some chance, his birthday will be compared with the ticket seller’s birthday. If you were given the chance, which position of the queue would you have wanted?  (I know that many of you would have liked other names as a dinner partner. Don’t hesitate to replace Schwarzenegger with that name, as you may need all those inspirations to solve this problem.)



Fig: Arnold Schwarzenegger as Terminator

Input

The input file contains several lines of input. Each line contains an integer N (30<=N<100001), which indicates how many days make a year. Input is terminated by end of file.

 

Output

For each line of input, output one floating-point number and one integer in a single line, separated by a single space. The floating-point number is the best floating point position for you (with two digits after the decimal point) and the integer is the best integer position (in reality position must be an integer) for you in the queue.

 

Sample Input

365
200

 

Sample Output                    

18.61 19
13.65 14

while(cin>>n&&n)
{
    int t=(sqrt(1+4*n)+1)/2;
    double a=(sqrt(1+4*n)-1)/2;
    printf("%.2lf %d\n",a,t);
}


你可能感兴趣的:(Algorithm,ACM,poj,uva,CString)