The problem is indeed in the line that mamum quoted. One of the reasons is that the floating point->integer cast is not a rounding operation. There are other subtlties to fix too.totobogy wrote:I just checked it by copying and compiling the code again it gives 31 671.
wat can be the problem?
Search found 21 matches
- Tue Jan 17, 2006 4:04 am
- Forum: Volume 1 (100-199)
- Topic: 107 - The Cat in the Hat
- Replies: 278
- Views: 54813
- Tue Jan 17, 2006 4:02 am
- Forum: Volume 1 (100-199)
- Topic: 107 - The Cat in the Hat
- Replies: 278
- Views: 54813
I got the correct answer for this case, too. It may be computer dependent.mamun wrote:Check this lineCan you find the mistake now?Code: Select all
if((unsigned long) pow(n,(double)1/d)+1 == (unsigned long) pow(h,(double)1/d))
I wonder how you got correct answer in your computer with this mistake!
- Fri Jan 13, 2006 5:02 am
- Forum: Volume 100 (10000-10099)
- Topic: 10078 - The Art Gallery
- Replies: 20
- Views: 8981
- Thu Jan 12, 2006 6:22 am
- Forum: Volume 100 (10000-10099)
- Topic: 10078 - The Art Gallery
- Replies: 20
- Views: 8981
Re: 10078 tests
Can anyone give me some data tests so I can find my mistake? For exemple what should be the output for this test:
7
3 0
6 1
7 5
5 8
3 8
2 7
2 6
8
3 0
6 1
7 5
5 8
3 8
2 7
2 6
1 5
6
3 1
5 6
4 6
3 7
2 6
1 6
5
1 1
1 5
3 5
6 7
9 5
3
1 1
2 2
2 0
4
0 0
0 1000
500 501
1000 0
4
0 0
0 1000
500 499
1000 0
0 ...
7
3 0
6 1
7 5
5 8
3 8
2 7
2 6
8
3 0
6 1
7 5
5 8
3 8
2 7
2 6
1 5
6
3 1
5 6
4 6
3 7
2 6
1 6
5
1 1
1 5
3 5
6 7
9 5
3
1 1
2 2
2 0
4
0 0
0 1000
500 501
1000 0
4
0 0
0 1000
500 499
1000 0
0 ...
- Mon Jun 27, 2005 6:21 pm
- Forum: Volume 1 (100-199)
- Topic: 100 - The 3n + 1 problem
- Replies: 1394
- Views: 317759
100 - TLE
Hi.
I'm a newbie @ Java.
I am trying to transplant the problems I solved in C++ to Java.
The following code always gives TLE:
import java.io.*;
import java.util.*;
class Main
{
static String token( String delim ){
char c = delim.charAt(0);
StringBuffer s = new StringBuffer("");
try{
while ...
I'm a newbie @ Java.
I am trying to transplant the problems I solved in C++ to Java.
The following code always gives TLE:
import java.io.*;
import java.util.*;
class Main
{
static String token( String delim ){
char c = delim.charAt(0);
StringBuffer s = new StringBuffer("");
try{
while ...
- Wed Nov 10, 2004 2:40 am
- Forum: Volume 2 (200-299)
- Topic: 291 - The House Of Santa Claus
- Replies: 19
- Views: 8987
- Wed Nov 03, 2004 2:04 pm
- Forum: Volume 1 (100-199)
- Topic: 103 - Stacking Boxes
- Replies: 200
- Views: 50209
- Wed Nov 03, 2004 2:03 pm
- Forum: Volume 1 (100-199)
- Topic: 195 - Anagram
- Replies: 242
- Views: 58077
- Mon Nov 01, 2004 8:25 am
- Forum: Volume 1 (100-199)
- Topic: 195 - Anagram
- Replies: 242
- Views: 58077
- Mon Nov 01, 2004 8:21 am
- Forum: Volume 1 (100-199)
- Topic: 195 - Anagram
- Replies: 242
- Views: 58077
- Sun Oct 31, 2004 12:35 pm
- Forum: Volume 2 (200-299)
- Topic: 291 - The House Of Santa Claus
- Replies: 19
- Views: 8987
- Fri Oct 29, 2004 5:28 pm
- Forum: Volume 100 (10000-10099)
- Topic: 10099 - The Tourist Guide
- Replies: 91
- Views: 42987
- Thu Oct 28, 2004 5:11 pm
- Forum: Volume 100 (10000-10099)
- Topic: 10098 - Generating Fast
- Replies: 62
- Views: 21600
- Wed Oct 27, 2004 6:14 am
- Forum: Volume 1 (100-199)
- Topic: 180 - Eeny Meeny
- Replies: 34
- Views: 36483
- Tue Oct 26, 2004 4:01 pm
- Forum: C++
- Topic: How to skip lines while using cin <<
- Replies: 7
- Views: 6418