Search found 21 matches

by eg_frx
Tue Jan 17, 2006 4:04 am
Forum: Volume 1 (100-199)
Topic: 107 - The Cat in the Hat
Replies: 278
Views: 22132

totobogy wrote:I just checked it by copying and compiling the code again it gives 31 671.
wat can be the problem?
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.
by eg_frx
Tue Jan 17, 2006 4:02 am
Forum: Volume 1 (100-199)
Topic: 107 - The Cat in the Hat
Replies: 278
Views: 22132

mamun wrote:Check this line

Code: Select all

if((unsigned long) pow(n,(double)1/d)+1 == (unsigned long) pow(h,(double)1/d))
Can you find the mistake now?
I wonder how you got correct answer in your computer with this mistake!
I got the correct answer for this case, too. It may be computer dependent.
by eg_frx
Fri Jan 13, 2006 5:02 am
Forum: Volume 100 (10000-10099)
Topic: 10078 - The Art Gallery
Replies: 20
Views: 6384

Found the trick.

Try the following input and see if you get it right

4
1 1
0 0
1 2
2 0
0

See the trick? (Well, at least this is the case i missed.)

Still, thanks for sharing helloneo. :D
by eg_frx
Thu Jan 12, 2006 6:22 am
Forum: Volume 100 (10000-10099)
Topic: 10078 - The Art Gallery
Replies: 20
Views: 6384

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 ?...
by eg_frx
Mon Jun 27, 2005 6:21 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 190724

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( delim.ind...
by eg_frx
Wed Nov 10, 2004 2:40 am
Forum: Volume 2 (200-299)
Topic: 291 - The House Of Santa Claus
Replies: 19
Views: 7039

help!
by eg_frx
Wed Nov 03, 2004 2:04 pm
Forum: Volume 1 (100-199)
Topic: 103 - Stacking Boxes
Replies: 200
Views: 21531

Guess you may use the STL function sort.
by eg_frx
Wed Nov 03, 2004 2:03 pm
Forum: Volume 1 (100-199)
Topic: 195 - Anagram
Replies: 242
Views: 28097

Sorry. Don't know exactly what's happening. Anyway, even if it did work, it would still genrate wrong answer. According to the problem discription characters are ordered alphabetically, which means a < D < d. Your operator will not generate correct result. In fact, your operator is not much differen...
by eg_frx
Mon Nov 01, 2004 8:25 am
Forum: Volume 1 (100-199)
Topic: 195 - Anagram
Replies: 242
Views: 28097

Try not use the same loop variable for different loops.
by eg_frx
Mon Nov 01, 2004 8:21 am
Forum: Volume 1 (100-199)
Topic: 195 - Anagram
Replies: 242
Views: 28097

Am still looking at your code, but before I give you any concrete answers, there are several points I'd like to suggest. 1. You don't need that sctruct to do the stuff. you may only implement and bool function that takes two chars and specify it when you use next_permutation. 2. STL function can not...
by eg_frx
Sun Oct 31, 2004 12:35 pm
Forum: Volume 2 (200-299)
Topic: 291 - The House Of Santa Claus
Replies: 19
Views: 7039

What is wrong with my code??????!?!?!?!!!!!!! My code generates exactly the same result as the 'correct one' above, but got WA!! Why?! Grateful for any help! Thanks [cpp] #include <iostream> #include <algorithm> using namespace std; void main(){ int route[7] = {2, 3, 1, 5, 3, 4, 5}; int process; boo...
by eg_frx
Fri Oct 29, 2004 5:28 pm
Forum: Volume 100 (10000-10099)
Topic: 10099 - The Tourist Guide
Replies: 91
Views: 29578

Did you print a blank line after each scenario?
by eg_frx
Thu Oct 28, 2004 5:11 pm
Forum: Volume 100 (10000-10099)
Topic: 10098 - Generating Fast
Replies: 62
Views: 14325

or if you use C++, you can be a lazy programer with the help of STL functions sort and next_permutation.
by eg_frx
Wed Oct 27, 2004 6:14 am
Forum: Volume 1 (100-199)
Topic: 180 - Eeny Meeny
Replies: 34
Views: 11038

Can anyone explain where my opinion is wrong? :P
by eg_frx
Tue Oct 26, 2004 4:01 pm
Forum: C++
Topic: How to skip lines while using cin <<
Replies: 7
Views: 4545

void skipline(int n) { int i,temp; for(i=0;i<n;i++)cin>>temp; } This function skips line.Paramiter n is the number of skip lines. Thanks :o It only works for single-integer lines. If the line has an alphabetic word, or more than one values, this will fail to do what you intended.

Go to advanced search