|
|
back to boardTLE test 3!!!! Posted by vk 4 Apr 2009 14:48 Re: TLE test 3!!!! and i have the same mistake Re: TLE test 3!!!! #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; } Re: TLE test 3!!!! 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? Re: TLE test 3!!!! 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] |
|
|