Search found 277 matches

by UFP2161
Thu May 27, 2004 7:49 pm
Forum: C++
Topic: compile error involving STL [ resolved ]
Replies: 2
Views: 1636

[c]string temp (1, 'a' + k);[/c] The string constructor is expecting an int, and a char .. However, you pass it an int and an int .. (['a' + k] will result in an int type as 'a' can be implicitly converted to int).. so, you should explicitly convert it back into a char like so: [c]string temp (1, (c...
by UFP2161
Thu May 27, 2004 5:42 pm
Forum: Volume 101 (10100-10199)
Topic: 10106 - Product
Replies: 98
Views: 27091

Your TLE stems from input such as
0
1
You'll get WA since input is like:
xxxx[newline]
xxxxxxx[newline]
Note the last newline and what it does to !cin.eof().
by UFP2161
Thu May 27, 2004 5:24 pm
Forum: Volume 4 (400-499)
Topic: 457 - Linear Cellular Automata
Replies: 25
Views: 11811

Kentaro:

You're not reading the input correctly. The first line is the number of test cases; the second is empty; the third is the first test case; the fourht is empty; etc.
by UFP2161
Thu May 27, 2004 5:18 pm
Forum: Volume 4 (400-499)
Topic: 447 - Population Explosion
Replies: 23
Views: 2294

For the first one, I got this after the 4th generation, which stays stable until forever: [c]******************** OO OO ********************[/c] My second output matches yours (it goes into that stable state 3 generations before the last one).
by UFP2161
Thu May 27, 2004 5:14 pm
Forum: Volume 106 (10600-10699)
Topic: 10609 - Fractal
Replies: 20
Views: 5954

Well, the distance between (10,10) and (10,10.999999) is 0.999999 which is less than 1, so don't even get past the first part of the fractal, while in the other one, the initial distance is 1, so it's greater than or equal to the threshold length, so it is equal. At least, that's how my program hand...
by UFP2161
Thu May 27, 2004 5:09 pm
Forum: Volume 5 (500-599)
Topic: 579 - Clock Hands
Replies: 44
Views: 13987

Ah, I think I see the problem. When I originally compiled your program I got the following warning: g++ test.cpp test.cpp: In function `int main()': test.cpp:13: warning: `double' used for argument 1 of `abs(int)' However, when I #include <cmath>, it works as expected. The judge is probably doing th...
by UFP2161
Thu May 27, 2004 1:49 am
Forum: Volume 4 (400-499)
Topic: 412 - Pi
Replies: 104
Views: 17881

If you've ever watched Star Trek, you might get it.. Yes, I know it has absolutely nothing to do w/ the picture.
by UFP2161
Wed May 26, 2004 11:23 pm
Forum: Volume 5 (500-599)
Topic: 579 - Clock Hands
Replies: 44
Views: 13987

[c]1:01[/c]
should output
[c]24.500[/c]
by UFP2161
Wed May 26, 2004 9:13 pm
Forum: Volume 1 (100-199)
Topic: 108 - Maximum Sum
Replies: 233
Views: 22493

This O(n^3) algorithm boggled me for a while too. There is a description of the O(n) algorithm for the maximum sum of a vector (i.e. just one of the rows of the matrix) in Programming Pearls by Bentley. I don't want to spoil anything. You can either find that book and read the relevant section, or t...
by UFP2161
Wed May 26, 2004 9:05 pm
Forum: Volume 106 (10600-10699)
Topic: 10609 - Fractal
Replies: 20
Views: 5954

I got slightly different outputs with my AC code: The diff file first: $ diff outAC outWA 61a62,63 > -51.50279 46.00069 > -51.50279 130.00031 66c68 < -27.25419 60.00063 --- > -27.25419 60.00062 72d73 < -3.00559 46.00069 74d74 < -3.00559 130.00031 80c80,82 < 0 --- > 2 > 10.00000 10.00000 > 10.00000 1...
by UFP2161
Wed May 26, 2004 8:52 pm
Forum: Volume 4 (400-499)
Topic: 412 - Pi
Replies: 104
Views: 17881

Random Input:
6
924
11365
5809
10130
14903
28986
0
Should output:
3.000000
But you output:
3.464102
by UFP2161
Wed May 26, 2004 6:03 pm
Forum: Volume 4 (400-499)
Topic: 447 - Population Explosion
Replies: 23
Views: 2294

[c]2 1 5 4 5 5 5 6 5 7 1 5 4 5 5 5 6 5 7[/c] [c]******************** OOOO ******************** <-- here ******************** <-- and here OOOO ********************[/c] From your description of your output, you don't print the asterisks between the two test cases.
by UFP2161
Wed May 26, 2004 4:54 am
Forum: Volume 4 (400-499)
Topic: 412 - Pi
Replies: 104
Views: 17881

Ah.. if you're compiling C.. you MUST declare all your variables before doing anything else, so either move your "int g" to the very first line of the function, or choose C++ instead, which doesn't have this problem..
by UFP2161
Wed May 26, 2004 12:48 am
Forum: Volume 4 (400-499)
Topic: 412 - Pi
Replies: 104
Views: 17881

Edit your profile and have the judge send results back to you by email. For CE, it will give you the exact output of the compiler.
by UFP2161
Wed May 26, 2004 12:46 am
Forum: Volume 106 (10600-10699)
Topic: 10653 - Bombs! NO they are Mines!!
Replies: 36
Views: 18060

[c]int ax[2][1000000], ay[2][1000000], canta = 1, cantv, mov = 0, p = 0;[/c]
The judge cannot allocate 16 MB of memory onto the stack, which is probably the reason for your RTE.

Go to advanced search