ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1705. Gangster Hares

vk TLE test 3!!!! [4] // Problem 1705. Gangster Hares 4 Apr 2009 14:48
yaho0o0 Re: TLE test 3!!!! [3] // Problem 1705. Gangster Hares 4 Apr 2009 16:01
and i have the same mistake
yaho0o0 Re: TLE test 3!!!! [2] // Problem 1705. Gangster Hares 4 Apr 2009 16:01
#include <iostream>
using namespace std;
int main()
{
    int i,a,t,j,o[30004];
    cin>>t;
    for(i=1;i<=t;i++)
    {
        cin>>a;
        for(j=1;j<=20;j++)
        {
            if(((a-(a%j))/j)<=(a%j))
            {
                o[i]=j;
                break;
            }
        }
    }
    for(i=1;i<=t;i++)
    {
        cout<<o[i]<<endl;
    }
    return 0;
}
Warmup for regional Re: TLE test 3!!!! [1] // Problem 1705. Gangster Hares 30 Apr 2009 16:55
I tried to solve the minimum K where (double)(n/k)-(double)(n/(k+1)) < 1.0 and then I iterate on this min_k till find the answer which [n/k]==[n/(k+1)], but I got TLE on test 3. Is there any special test case which cause me to get TLE?
Fyodor Menshikov Re: TLE test 3!!!! // Problem 1705. Gangster Hares 2 May 2009 16:38
Warmup for regional wrote 30 April 2009 16:55
Is there any special test case which cause me to get TLE?

There is no special test case in this problem, just maximal test.

t=30000.
n are random near 10^18 for example in the range [10^18-10^17, 10^18]