Search found 6 matches

by ubernewb
Thu Aug 09, 2007 6:26 pm
Forum: Volume 1 (100-199)
Topic: 106 - Fermat vs. Pythagoras
Replies: 138
Views: 30303

Accepted!
So, my problem was declaring that huge array locally in main. If instead I declare it globally, it works fine.
I'm guessing that the array can overflow main's stack, depending on your compiler/architecture/operating system. Thanks for all your help.
by ubernewb
Thu Aug 09, 2007 6:16 pm
Forum: Volume 1 (100-199)
Topic: 106 - Fermat vs. Pythagoras
Replies: 138
Views: 30303

That's really weird. I ran it with 1000000 as input, and got 159139 133926. But you're saying that when you run it, it comes out with a different answer.
There must be something wrong in my code that makes it have different output on different compilers/machines, but I can't figure out what that is.
by ubernewb
Wed Aug 08, 2007 6:19 pm
Forum: Volume 1 (100-199)
Topic: 106 - Fermat vs. Pythagoras
Replies: 138
Views: 30303

Tried that case, result came back OK. Here are the inputs I tried:
Input:
10
11
12
15
20
22
50
55
80
100
500
600
700
800
900
1000
10000
100000
1000000
33221
33222
33333
33337
33339
33344
33354
33355
33356
33357
99960
99961
99962
99963
99964
99965
99966
99967
99968
99969
99970
99980
99990
99995 ...
by ubernewb
Tue Aug 07, 2007 8:10 pm
Forum: Volume 1 (100-199)
Topic: 106 - Fermat vs. Pythagoras
Replies: 138
Views: 30303

I ran all the test cases in this thread, and they come out fine, but I'm still getting WA. Can someone help?

Code: Select all

Resolved
This is in C. If you have trouble compiling, try gcc -lm -o 106 106.c
Thanks
by ubernewb
Mon Aug 06, 2007 8:12 pm
Forum: Volume 1 (100-199)
Topic: 106 - Fermat vs. Pythagoras
Replies: 138
Views: 30303

106 Fermat vs. Pythagoras WA, why?

I tried all the inputs I found on this board, and the output matches the correct output, but I'm still getting WA on this one. Some sample input/output here.
Input:
10
100
1000
10000
100000
1000000
123
1234
12345
123456

Output:
1 4
16 27
158 205
1593 1669
15919 14844
159139 133926
19 26
197 238 ...
by ubernewb
Mon May 01, 2006 8:39 pm
Forum: Volume 1 (100-199)
Topic: 104 - Arbitrage
Replies: 223
Views: 37233

104 WA

Hey,
I'm trying to solve the arbitrage problem, but it's not behaving as expected. It's worked fine for all the sample data I found on this forum, but I'm still getting a WA on submit. Can someone help me? It's C++, by the way.


// Arbitrage

#include <iostream>
#include <sstream>
#include <stack ...

Go to advanced search