Search found 67 matches

by dumb dan
Thu Oct 07, 2004 1:07 pm
Forum: Volume 101 (10100-10199)
Topic: 10139 - Factovisors
Replies: 80
Views: 26741

looks ok as far as I can tell
by dumb dan
Tue Oct 05, 2004 11:22 am
Forum: Volume 1 (100-199)
Topic: 154 - Recycling
Replies: 29
Views: 3271

input:

Code: Select all

g/N,y/G,o/S,r/A,b/P
y/N,b/S,r/G,g/A,o/P
r/N,y/G,o/S,b/P,g/A
e
r/A,y/G,o/S,b/P,g/N
r/G,y/N,o/P,b/S,g/A
r/N,y/G,o/S,b/P,g/A
e
#
output:

Code: Select all

3
3
by dumb dan
Tue Oct 05, 2004 10:32 am
Forum: Volume 1 (100-199)
Topic: 154 - Recycling
Replies: 29
Views: 3271

You might want to initilize min to something larger than 6.
min=500 should suffice.
by dumb dan
Mon Oct 04, 2004 8:19 pm
Forum: Volume 4 (400-499)
Topic: 495 - Fibonacci Freeze
Replies: 222
Views: 30515

This code gets me AC in 3.2 seconds when I use my own bigint class.
(Although it only needs 0.13s to generate all fibonacci numbers on my computer)

You need to optimize either your bigint class or your algoritm.
by dumb dan
Mon Oct 04, 2004 7:41 pm
Forum: Volume 3 (300-399)
Topic: 337 - Interpreting Control Sequences
Replies: 20
Views: 4249

Code: Select all

for( i = 0 ; i < numLines ; i++ ) 
{

...

    case 'e' : 
      i = curXPos;

...

}
You use i for two different things at the same time!
by dumb dan
Mon Oct 04, 2004 6:34 pm
Forum: Volume 101 (10100-10199)
Topic: 10139 - Factovisors
Replies: 80
Views: 26741

You seem to have tested quite alot, and they all look ok. Here are a few more: input: 94764610 284293833 94764612 284293833 11 479001600 21471 2147483647 7 32 8 128 8 256 output: 284293833 does not divide 94764610! 284293833 divides 94764612! 479001600 does not divide 11! 2147483647 does not divide ...
by dumb dan
Sun Oct 03, 2004 6:08 pm
Forum: Volume 6 (600-699)
Topic: 612 - DNA Sorting
Replies: 122
Views: 16120

store = count(str,51);

I think you want to change that to

store = count(str,n);

Besides that you'll get a PE if you don't seperate each case with a blank line.
by dumb dan
Sun Oct 03, 2004 5:45 pm
Forum: Volume 106 (10600-10699)
Topic: 10622 - Perfect P-th Powers
Replies: 47
Views: 24021

ah sorry... example is above...
(thought I'd be able to edit my post with an example before you read it)
:wink:
by dumb dan
Sun Oct 03, 2004 5:35 pm
Forum: Volume 106 (10600-10699)
Topic: 10622 - Perfect P-th Powers
Replies: 47
Views: 24021

You can't just multiply negative values by -1 and expect to get the right answer. For example:

input:

Code: Select all

4
-4
0
ouput:

Code: Select all

2
1
by dumb dan
Sun Oct 03, 2004 4:59 pm
Forum: Volume 6 (600-699)
Topic: 612 - DNA Sorting
Replies: 122
Views: 16120

This is a multiple input problem!
by dumb dan
Sun Oct 03, 2004 3:52 pm
Forum: Volume 2 (200-299)
Topic: 264 - Count on Cantor
Replies: 47
Views: 13655

input: 1000000 1234567 2897534 3897346 4482323 5809231 6898729 7829873 8298733 9908727 10000000 output: TERM 1000000 IS 1009/406 TERM 1234567 IS 240/1332 TERM 2897534 IS 495/1913 TERM 3897346 IS 1110/1683 TERM 4482323 IS 1802/1193 TERM 5809231 IS 3115/295 TERM 6898729 IS 3688/27 TERM 7829873 IS 1031...
by dumb dan
Sun Oct 03, 2004 3:28 pm
Forum: Volume 1 (100-199)
Topic: 106 - Fermat vs. Pythagoras
Replies: 138
Views: 12115

Your code doesn't even succeed on the sample input. input: 10 25 100 your output: 1 0 4 1 16 0 16 0 correct output: 1 4 4 9 16 27 For starters you process the last input twice since you check cin.eof() before your cin >> N; statement. Try changing it to: //while (!cin.eof()) { //cin >> N; while (cin...
by dumb dan
Sun Oct 03, 2004 2:52 pm
Forum: Volume 1 (100-199)
Topic: 101 - The Blocks Problem
Replies: 635
Views: 38481

> Any command in which a = b or in which a and b are in the same stack of blocks is an illegal command. All illegal commands should be ignored and should have no affect on the configuration of blocks.

This input will result in runtime error for you:

10
move 6 onto 6
quit
by dumb dan
Sun Oct 03, 2004 1:39 pm
Forum: Volume 1 (100-199)
Topic: 108 - Maximum Sum
Replies: 233
Views: 22676

For a one-dimensional problem: [x1 x2 x3 ... xn]
You need to keep track of partial sums. For example
make a new array [s1 s2 s3 .... sn] where:
s1 = x1
s2 = max(x2, s1+x2)
s3 = max(x3, s2+x3)
...
sn = max(xn, s(n-1)+xn)
max_sum=max(s1, s2, s3, ..., sn)

Go to advanced search