Search found 143 matches

by angga888
Sun Aug 21, 2005 3:39 pm
Forum: Volume 102 (10200-10299)
Topic: 10234 - Frequent Substrings
Replies: 25
Views: 9035

Re: 10234 Frequent substrings please Inputs/ Outputs !!

I haven't understood well if I should print the most frequent substring as lowercase substring, or just the most frequent substring found in it's least lexicographically way ... Just ouput the most frequent substring as lowercase substring. So for your input, my AC code outputs: 3 abc Hope it helps...
by angga888
Fri Aug 19, 2005 1:47 pm
Forum: Other words
Topic: multiple topics on the same problem
Replies: 3
Views: 1040

Re: multiple topics on the same problem

Martin Macko wrote:Why do people tend to create a new topic on a problem if there is already one?
Maybe because they think that the previous posts are no longer relevant with their current problems :wink:
by angga888
Wed Aug 17, 2005 5:25 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 189285

Hi fadia ismael, I guess the problem is with the scope of your variable for (unsigned long int i=1; min!=1; i++){ if (min%2==0) min=min/2; else min= 3*min + 1; } out= out>i? out : i; the variable 'i' is already out of scope when it is accessed by the line out= out>i? out : i; Maybe you would move th...
by angga888
Mon Aug 15, 2005 3:10 pm
Forum: Volume 5 (500-599)
Topic: 583 - Prime Factors
Replies: 171
Views: 37714

I think you should change this:

Code: Select all

for( i = 0 ; prime[i]*prime[i] <= x ; i++ ) 
        { 
            ...
        } 
into:

Code: Select all

for( i = 0 ; i < Cprime && prime[i]*prime[i] <= x ; i++ ) 
        { 
            ...
        } 
that is possibly your mistake :wink:
by angga888
Mon Aug 15, 2005 2:48 pm
Forum: Volume 108 (10800-10899)
Topic: 10827 - Maximum sum on a torus
Replies: 52
Views: 27849

My AC program outputs:

Code: Select all

10126
2682
3632
2626
1549
4379
1277
5474
3887
2789
Good luck :D
by angga888
Sun Jul 31, 2005 8:16 am
Forum: Volume 103 (10300-10399)
Topic: 10311 - Goldbach and Euler
Replies: 98
Views: 23480

Re: 10311-WHY MLE??

Nazmul Quader Zinnuree wrote: #define LIMIT 100000005
#define BLOCK sizeof(char)

char prime[(LIMIT / BLOCK) / 2 + 2];
I think it should be

Code: Select all

#define LIMIT 100000005
#define BLOCK 8*sizeof(char)

char prime[(LIMIT / BLOCK) / 2 + 2];
by angga888
Thu Jul 28, 2005 8:37 pm
Forum: Volume 5 (500-599)
Topic: 591 - Box of Bricks
Replies: 80
Views: 11674

Hmm.. weird... It should be correct

Maybe you can check the error message from the email sent by the judge. :wink:
by angga888
Tue Jul 19, 2005 11:33 am
Forum: Volume 7 (700-799)
Topic: 714 - Copying Books
Replies: 29
Views: 19737

Re: 714 (Copying books) - greedy approach?

Can this problem be solved using a greedy algorithm? Yes, it is. :wink: The basic idea is: Search the maximum number of pages assigned to the scribers. For every number of maximum pages you searched, you can check whether that number is too big or too small by assigning the books to the scribers gr...
by angga888
Tue Jul 19, 2005 11:18 am
Forum: Volume 100 (10000-10099)
Topic: 10003 - Cutting Sticks
Replies: 59
Views: 24959

Code: Select all

for i := 0 to 2000 do 
   for j := 0 to 2000 do 
    dp[i, j] := 99999;
You only need to initialize the variable as needed. No need to always perform 2000*2000 loop as above. :wink:
by angga888
Fri Jun 25, 2004 7:48 am
Forum: Volume 106 (10600-10699)
Topic: 10656 - Maximum Sum (II)
Replies: 52
Views: 16520

Re: 10656

htl wrote:How about the in/out below?
Same with my AC code. :wink:
by angga888
Mon Jun 21, 2004 5:43 pm
Forum: Pascal
Topic: Modules
Replies: 1
Views: 4830

Do not know exactly, but at least uses Math is allowed. :wink:
by angga888
Sun Jun 20, 2004 10:56 am
Forum: Volume 101 (10100-10199)
Topic: 10130 - SuperSale
Replies: 76
Views: 23054

htl wrote:Why the answer of sohel's input is 19?
Which one? Do you mean the input in the first post here? If yes, the answer is not 19, but 21.
by angga888
Sun Jun 20, 2004 8:59 am
Forum: Volume 4 (400-499)
Topic: 434 - Matty's Blocks
Replies: 13
Views: 3716

Re: Why I get WA in 434

qndel wrote:var
temp,prawo:array[0..8] of byte;
przod:array[0..8,1..3] of byte;
s,m,t,n,k,j,i:byte;
Why do you use byte? change them with integer.
by angga888
Sun Jun 20, 2004 8:47 am
Forum: Volume 1 (100-199)
Topic: 162 - Beggar My Neighbour
Replies: 31
Views: 5177

Output for shuniu's input:

Code: Select all

2 51
2 49
2 51
2 48
1 47
2 41
2 44
1 42
1 45
2 34
1 51
2 48
2 38
1 49
2 44
2 51
1 49
1 43
2 50
2 51
2 51
1 48
1 49
2 49
2 40
2 44
1 47
1 47
1 51
1 44
Good luck!
by angga888
Sun Jun 20, 2004 8:39 am
Forum: Volume 1 (100-199)
Topic: 116 - Unidirectional TSP
Replies: 226
Views: 37530

I reversed it. Instead of trying to find minimum sum from left to right, it goes from right to left. Now it works. I have no clue why, I think they should both give the same answer. Yes, I'm also using the same method. Be careful with lexicographical order. Instead of working from left to right, it...

Go to advanced search