Search found 47 matches

by jackie
Thu Oct 07, 2004 2:08 pm
Forum: Volume 104 (10400-10499)
Topic: 10433 - Automorphic Numbers
Replies: 41
Views: 23210

I suffered the same problem and got many WAs. After that i realized the 2000 digits long const char array may cause the problem. Just use "\" to break the long line, i get AC. ie. char r5[MAX+10] = "0302695456948792438016548848805106486276062082716415\ 91325236097905009383854054263247198939318022098...
by jackie
Thu Oct 07, 2004 8:37 am
Forum: Volume 104 (10400-10499)
Topic: 10436 - Cheapest way
Replies: 18
Views: 6298

The problem setter said: It is guaranteed that each map description is valid, and the query has a valid and unique path. But i don't think it's correct after many WAs and finaly AC. The trouble is "unique path". If you use differnt algorithm. it may generate different path and the passenger cost is ...
by jackie
Tue Sep 28, 2004 4:56 pm
Forum: Volume 104 (10400-10499)
Topic: 10440 - Ferry Loading II
Replies: 10
Views: 7236

Consider the last n cars they should be in one ferry for the optimization time.
by jackie
Thu Aug 26, 2004 12:22 pm
Forum: Volume 5 (500-599)
Topic: 590 - Always on the run
Replies: 12
Views: 6677

I just finished it. You may not consider it as a graph problem. Just for each day calculate the min cost from paris to other cities. Surely you can get min cost from paris after first day. Then for the second day from the results we just calculate it's easy to get the min cost for every city after t...
by jackie
Wed Aug 18, 2004 12:38 pm
Forum: Volume 106 (10600-10699)
Topic: 10682 - Forró Party
Replies: 14
Views: 9013

BFS works for this problem. Better to use adjcent table than adjacent matrix. Though there is no mutiple edges between two citis in the judge's input or it doesn't effect the anwser if you use adjacent matrix You can assume that A and B are not the same city and can exist more than one road between ...
by jackie
Mon Aug 16, 2004 3:34 pm
Forum: Volume 3 (300-399)
Topic: 383 - Shipping Routes
Replies: 27
Views: 5824

After 5 PEs i get AC.

Just output like the sample output.

But pay attention to the case p = 0

After "DATA SET n" there is one blank line, after p lines answer there is also one blank line. Consider the case p = 0, only one blank line should be output.

hope it can help

good luck.
by jackie
Wed Aug 11, 2004 11:40 am
Forum: Volume 5 (500-599)
Topic: 598 - Bundling Newspapers
Replies: 25
Views: 8953

My AC program gives same output as yours. I just use simple backtrace algorithm. The input and output is tedious. here is my input and output code [cpp] scanf("%d", &n); gets(tmp), gets(tmp); for (NULL; n--; NULL) { gets(tmp); c = sscanf(tmp, "%d%d", &a, &b); t = 0; for (NULL; gets(buf[t]) && buf[t]...
by jackie
Tue Aug 10, 2004 12:42 pm
Forum: Volume 5 (500-599)
Topic: 587 - There's treasure everywhere!
Replies: 37
Views: 2614

try this input 10NW,10NE,10SW,10SE. if you use windows + VC++ you may get 0.000 but with linux + gcc you get -0.000 which causes WA. The reason is the difference between the two compiler when processing 'double' multiplication or you can just mention it precision error. solution: you may initial x, ...
by jackie
Sat Aug 07, 2004 8:18 am
Forum: Volume 5 (500-599)
Topic: 545 - Heads
Replies: 67
Views: 43817

I got tons of WAs before AC. Algorithm is just the same as 474. My friend got AC and we have the same answer for all n (1<=n<=9000) on windows XP + VC++6.0. But the judge always said WA. Then I find the special precison lost when n = 6 and n = 7 which means 2^-6 = 1.56250E-2 2^-7 = 7.81250E-3 you ha...
by jackie
Thu Aug 05, 2004 9:36 am
Forum: Volume 5 (500-599)
Topic: 568 - Just the Facts
Replies: 39
Views: 16548

Just factor 2 and factor 5 make 0s in the result and obviously factor 2 is more than factor 5 in the factorial. Think about the last digits which don't contain 2 or 5s then add num(2) - num(5) 2s to the result and get the answer. num(n) how many factor ns in the factorial. hope it can help good luck
by jackie
Wed Aug 04, 2004 2:47 pm
Forum: Volume 5 (500-599)
Topic: 550 - Multiplying by Rotation
Replies: 7
Views: 4268

There may be 0 or 1 (special cases) in the judge's test data. It may cause your program run into infinite loop. It cause my program WA for many times. :( Finally get AC and find the program run quite fast. :D D ------> last digit X ------> digits before D if X is only one digit then (X * base + D) *...
by jackie
Tue Aug 03, 2004 1:19 pm
Forum: Volume 4 (400-499)
Topic: 465 - Overflow
Replies: 104
Views: 24036

After many WAs i change the algorithm. Use double instead of big number. and i get AC. Then i find the judge's input doesn't contain line like 1000000*10000 or 1000000 + -1 simply input [cpp] while (scanf("%s%s%s", a, op, b) == 3) { printf("%s %s %s\n", a, op, b); //decide how to output }[/cpp] hope...
by jackie
Tue Aug 03, 2004 4:59 am
Forum: Volume 3 (300-399)
Topic: 332 - Rational Numbers from Repeating Fractions
Replies: 83
Views: 19915

k + j <= 9 so the integer will work

if you use double you may suffer precision problem
by jackie
Tue Aug 03, 2004 3:47 am
Forum: Volume 100 (10000-10099)
Topic: 10042 - Smith Numbers
Replies: 75
Views: 22996

I use int and get AC.
by jackie
Tue Aug 03, 2004 3:39 am
Forum: Volume 100 (10000-10099)
Topic: 10042 - Smith Numbers
Replies: 75
Views: 22996

my AC program output
22
27
58
4937775
4937818
1000000165
31639

Go to advanced search