Search found 185 matches

Tue Jul 06, 2004 6:05 pm
Forum: Volume 104 (10400-10499)
Topic: 10465 - Homer Simpson
Replies: 75
Views: 23417
I solve it in a traditional way. I used a array with t items. Could someone tell me the faster way?
Mon Jul 05, 2004 6:03 pm
Forum: Volume 3 (300-399)
Topic: 384 - Slurpys
Replies: 8
Views: 1955

384

I've heard that there's a 'linear solution'. I've also heard that there's a recurrance solution. I tried the latter and got TLE. Could someone give some advice?
Fri Jul 02, 2004 4:39 am
Forum: Volume 106 (10600-10699)
Topic: 10622 - Perfect P-th Powers
Replies: 47
Views: 24458
After thinking, I got my final version of my algo.
1.Checking if there is a power of a prime=|n| from the smallest in the prime table.
2.Checking the times. If n>0 then print the times. If n<0 then dividing the times with 2 until times%2==1, then print times.

Is there something wrong in my algorithm?
Thu Jul 01, 2004 6:30 pm
Forum: Volume 106 (10600-10699)
Topic: 10622 - Perfect P-th Powers
Replies: 47
Views: 24458
I tried many times and got many WA... I don't know what's wrong with my code. I'm sure that the prime table has no fault. I post part of my code hoping someone would point out the bug in my code.
[c]
Silly code could mislead somebody... so deleted..
[/c]
Thu Jul 01, 2004 11:18 am
Forum: Volume 106 (10600-10699)
Topic: 10679 - I Love Strings!!
Replies: 101
Views: 49305
Could someone provide the resources on the internet about the two algorithms (aho and Ukkonen)? I tried hard and found few of them.
Wed Jun 30, 2004 9:27 am
Forum: Volume 106 (10600-10699)
Topic: 10680 - LCM
Replies: 38
Views: 12923
hello dll, my AC program gives the answer as below:

2
2
2
4
6
6
6
8
4
2
2
4
8
8
8
8
6
2
2
2
6
8
8
8
8
8
8
8

Hope it helps
Wed Jun 30, 2004 5:20 am
Forum: C
Topic: Dev-C++ supports long long type?
Replies: 4
Views: 2723
You're right. It really works! But I think I have to write as %lld before submitting.
Wed Jun 30, 2004 4:41 am
Forum: Volume 106 (10600-10699)
Topic: 10680 - LCM
Replies: 38
Views: 12923
Thanks for rakeb's hint. I solved it in less than 0.4sec. To abishek: Let's make a table[1000000], then you might find out that if N is not a power of a prime, table[N] would equal to table[N-1], or you have to find out the answer. You can do some precalculating to reduce the time to do this. And be...
Tue Jun 29, 2004 2:51 pm
Forum: Volume 106 (10600-10699)
Topic: 10680 - LCM
Replies: 38
Views: 12923

10680 - LCM

Do I have to make a table by precalculating? I only consider the last digit of every primes less than 1000000 and the times of 2 and 5. I use the cycle of last digit to reduce the work. But I do calculating every time encountering a new number and get TLE. How do I boost my program?
Tue Jun 29, 2004 10:14 am
Forum: Volume 106 (10600-10699)
Topic: 10677 - Base Equality
Replies: 11
Views: 3515
Could you calculate the last data of the sample in this problem? Then I would figure out what you really means.
Tue Jun 29, 2004 8:08 am
Forum: Volume 106 (10600-10699)
Topic: 10677 - Base Equality
Replies: 11
Views: 3515

10677 - Base Equality

I agree that (1040)16%(1040)10=0 and (4240)16%(4240)10=0. But it seems that (9240)14%(9240)11!=0, or I misunderstand the problem?
Mon Jun 28, 2004 4:42 pm
Forum: Volume 101 (10100-10199)
Topic: 10168 - Summation of Four Primes
Replies: 51
Views: 20848
I feel confused. There are 664579 prime numbers less than 10000000. If I build a table including these numbers, every time I test a number, I use only log664579/log2 (less than 25) times at worst by bsearch. It spends over 1sec. If I build a table including 446 prime numbers not greater than sqrt(1e...
Mon Jun 28, 2004 9:19 am
Forum: Volume 103 (10300-10399)
Topic: 10351 - Cutting Diamonds
Replies: 10
Views: 5365
Could someone give some critical data? I can't figure out what's wrong with my program. Btw, can I swap the only different pair
(6 7 4 6 8 4 -> 7 6 4 8 6 4) to solve in a convenient way?
Mon Jun 28, 2004 7:25 am
Forum: Volume 103 (10300-10399)
Topic: 10345 - Cricket/Football Goes Down
Replies: 12
Views: 4912
I think that the equations of Ivan are based on the assumption that the upper-right side of the lower-left square of fig.6 touches the lower-left vertex of the square in the center.
Fri Jun 25, 2004 4:33 am
Forum: Volume 106 (10600-10699)
Topic: 10656 - Maximum Sum (II)
Replies: 52
Views: 16590

10656

Could someone give me more test case?

How about the in/out below?

in:
5
1
2
3
0
0
3
1
1
1
3
0
0
0
0

out:
1 2 3
1 1 1
0