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.
Search found 6 matches
- Thu Aug 09, 2007 6:26 pm
- Forum: Volume 1 (100-199)
- Topic: 106 - Fermat vs. Pythagoras
- Replies: 138
- Views: 30303
- 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.
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.
- Wed Aug 08, 2007 6:19 pm
- Forum: Volume 1 (100-199)
- Topic: 106 - Fermat vs. Pythagoras
- Replies: 138
- Views: 30303
- 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?
This is in C. If you have trouble compiling, try gcc -lm -o 106 106.c
Thanks
Code: Select all
Resolved
Thanks
- 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 ...
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 ...
- 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 ...
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 ...