Search found 70 matches

by Timo
Mon Apr 24, 2006 7:34 am
Forum: Algorithms
Topic: bisection or something else..
Replies: 15
Views: 2935

how about if try all possibility.

D = A -> dis(B,D) + dis(C,D)

D = B -> dis(A,D) + dis(C,D)

D = C -> dis(A,B) + dis(B,D)

I think it should be give the minimum total distance
:D
by Timo
Mon Apr 24, 2006 7:26 am
Forum: Volume 8 (800-899)
Topic: 834 - Continued Fractions
Replies: 20
Views: 12831

Hi sohag144, I have create random sample input and output from my AC program. Hope it help you. Input : 688 558 366 699 673 854 352 375 755 606 344 850 797 944 584 330 505 687 787 440 90 325 177 440 352 274 75 908 527 411 601 94 746 318 602 691 459 236 394 206 642 182 411 686 160 196 357 991 111 199...
by Timo
Mon Apr 24, 2006 6:50 am
Forum: Volume 110 (11000-11099)
Topic: 11003 - Boxes
Replies: 29
Views: 17054

Code: Select all

code removed...
 
I have change a little part of your code.
This one should be AC.

:D

"sorry jan_holmes topik yg aku post sebelumnya ada kesalahan sedikit,
gara2 aku kamu jadi dapet WA, thanx untuk koreksi yang kamu berikan, manusia tidak luput dari kesalahan"
by Timo
Sat Apr 22, 2006 5:16 am
Forum: Volume 108 (10800-10899)
Topic: 10830 - A New Function
Replies: 33
Views: 15569

For IRA #define I long long I CSOD(I n) { I i,out2=0,j=sqrt(n); for(i=2;i<=j;i++) out2 += (n/i)*i; // O(sqrt(n)) for(i--;j>=1;j--) { out2 += (j*sum(i+1,n/j)); i=(n/j); } // O(sqrt(n)) // last operation before return only take O(1) return out2; } if see my snippet code maybe you can understand why th...
by Timo
Sat Apr 22, 2006 5:15 am
Forum: Volume 108 (10800-10899)
Topic: 10830 - A New Function
Replies: 33
Views: 15569

#define I long long I CSOD(I n) { I i,out2=0,j=sqrt(n); for(i=2;i<=j;i++) out2 += (n/i)*i; // O(sqrt(n)) for(i--;j>=1;j--) { out2 += (j*sum(i+1,n/j)); i=(n/j); } // O(sqrt(n)) // last operation before return only take O(1) return out2; } maybe you can understand why the time complexity is O(sqrt(n)...
by Timo
Sat Apr 22, 2006 5:13 am
Forum: Volume 108 (10800-10899)
Topic: 10830 - A New Function
Replies: 33
Views: 15569

#define I long long I CSOD(I n) { I i,out2=0,j=sqrt(n); for(i=2;i<=j;i++) out2 += (n/i)*i; // O(sqrt(n)) for(i--;j>=1;j--) { out2 += (j*sum(i+1,n/j)); i=(n/j); } // O(sqrt(n)) // last operation before return only take O(1) return out2; } maybe you can understand why the time complexity is O(sqrt(n)...
by Timo
Fri Apr 21, 2006 10:19 am
Forum: Volume 108 (10800-10899)
Topic: 10830 - A New Function
Replies: 33
Views: 15569

root(N) = sqrt(N)

root(25) = 5
root(36) = 6

:D
by Timo
Fri Apr 21, 2006 9:31 am
Forum: Volume 110 (11000-11099)
Topic: 11003 - Boxes
Replies: 29
Views: 17054

Hi arsalan_mousavian :D This problem very similiar with Knapsack Problem. In Knapsack Problem we want maximum profit that we can take, but in this problem we want maximum box that we can take. I will describe to you my algo let's we define: best(i,j) -> the maximum box that I can take from the first...
by Timo
Sat Apr 15, 2006 1:01 pm
Forum: Algorithms
Topic: Please Help Me
Replies: 9
Views: 2035

Thanks I have got the idea

:D
by Timo
Sat Apr 15, 2006 7:47 am
Forum: Volume 109 (10900-10999)
Topic: 10925 - Krakovia
Replies: 50
Views: 21651

Don't be stress :D you can use my divide function #include <stdio.h> int Divide(char hasil[],int F,char out[]) { int i, j, x; x=0; i=0; while(hasil[i]) { x *= 10; x += hasil[i++]-'0'; if(x>=F) break; } j=0; do { if(x>=F) { out[j++] = (x/F)+'0'; x = x%F; } else out[j++]='0'; if(hasil[i]=='\0') break;...
by Timo
Sat Apr 15, 2006 7:02 am
Forum: Algorithms
Topic: Graph problems
Replies: 1
Views: 1244

Here are some graph problem : 193 Graph Coloring 259 Software Allocation 459 Graph Connectivity 677 All Walks of length n from the first node 820 Internet Bandwidth 10004 Bicoloring 10080 Gopher II 10092 The Problem with the Problemsetter 10122 Mysterious Mountain 10330 Power Transmission 10380 Shog...
by Timo
Sat Apr 15, 2006 6:49 am
Forum: Algorithms
Topic: Please Help Me
Replies: 9
Views: 2035

m can be same with n.

This link will lead you to the original problem

http://acm.hziee.edu.cn/showproblem.php?pid=1024

please explain to me your method Krzysztof Duleba if you get AC :D

Thanks
by Timo
Thu Apr 13, 2006 5:24 am
Forum: Algorithms
Topic: Please Help Me
Replies: 9
Views: 2035

Thanx Cosmin for your link.

but I still can't solve this problem, because the value of m > 0

if m=1 I can solve this problem using Kadane's Algo it is only O(N)
but if m>=2 I can't solve this.

Please explain to me your method

Thanx
by Timo
Wed Apr 12, 2006 12:00 pm
Forum: Algorithms
Topic: Please Help Me
Replies: 9
Views: 2035

Please Help Me

I have a problem like this : Given a consecutive number sequence S1, S2, S3, S4 ... Sx, ... Sn (1 <= x <= n <= 1,000,000, -32768 <= Sx <= 32767). We define a function sum(i, j) = Si + ... + Sj (1 <= i <= j <= n). Now given an integer m (m > 0), your task is to find m pairs of i and j which make sum(...
by Timo
Sat Apr 01, 2006 9:50 pm
Forum: Volume 110 (11000-11099)
Topic: 11026 - A Grouping Problem
Replies: 28
Views: 18225

Hi Jan, this problem can be solved using Dynamic Programming.

if there are 4 elements

Go to advanced search