Search found 44 matches

by snar
Fri Sep 14, 2007 5:55 pm
Forum: Volume 101 (10100-10199)
Topic: 10172 - The Lonesome Cargo Distributor
Replies: 9
Views: 4204

It's nice that you gave me reply, jurajz, but why so late? :-? I posted this two years ago. Happy to know that you solved this problem. Congratulations! See you on the board in the future!
by snar
Fri Jul 27, 2007 9:43 pm
Forum: Volume 1 (100-199)
Topic: 114 - Simulation Wizardry
Replies: 80
Views: 7611

114 - Simulation Wizardry - Confused

Hello, I searched in all previous topics related to this problem. But I have some questions. The definition of "hitting" is the same for both walls and bumpers. To hit an obstacle you must move to the point ocuppied by it. That means lifetime decreses by 1 unit + cost of that obstacle. If it's lifet...
by snar
Tue Apr 24, 2007 8:21 pm
Forum: Volume 107 (10700-10799)
Topic: 10701 - Pre, in and post
Replies: 13
Views: 6105

10701 Runtime Error

Hi, please give me some test data, I'm getting RE. Here's my code. #include <stdio.h> char pre[53], in[53]; int n, i; void post(int p, int root, int q) { int left, right; for (left=0; left<n; left++) if (pre[left] == in[root]) break; left++; for (i=0; i<n; i++) if (in[i] == pre[left]) break; if (roo...
by snar
Tue Feb 20, 2007 4:47 pm
Forum: Off topic (General chit-chat)
Topic: Let's try to keep this forum useful for everyone!
Replies: 13
Views: 22231

Divide the forum

I think it would be fine, if we divide every volume (say starting from CXII) in 100 sections for every problem, then divide these sections in a few parts(for example WA, TLE). So, if somone have an error ERROR on problem PROBLEM, he must read the section PROBLEM->ERROR, and if that doesn't help, the...
by snar
Tue Feb 20, 2007 4:21 pm
Forum: Volume 111 (11100-11199)
Topic: 11170 - Cos(NA)
Replies: 22
Views: 13331

Re: what was ur approach??

During the real time contest, I tried this approach: 1] cos(mx) = cos(m/2x + m/2x) =cos^2(m/2x)-sin^2(m/2x)->for even m sin^2(nx) = 1 - cos^2(nx). So for even m, I could eliminate sin(). But for odd values of m, I couldn't get rid of sin(). After opening my A'Level Pure Maths book and a bit of goog...
by snar
Tue Feb 20, 2007 6:25 am
Forum: Volume 111 (11100-11199)
Topic: 11170 - Cos(NA)
Replies: 22
Views: 13331

Finally I got AC, but my solution run in more than 0,4 sec. I suppose, you're using another algorithm, right?
by snar
Mon Feb 19, 2007 9:54 pm
Forum: Volume 111 (11100-11199)
Topic: 11170 - Cos(NA)
Replies: 22
Views: 13331

mf wrote:Here are correct outputs for first few cases, for those who are getting WAs:

Code: Select all

Cos(A)
2Cos^2(A)-1
4Cos^3(A)-3Cos(A)
8Cos^4(A)-8Cos^2(A)+1
16Cos^5(A)-20Cos^3(A)+5Cos(A)
32Cos^6(A)-48Cos^4(A)+18Cos^2(A)-1
64Cos^7(A)-112Cos^5(A)+56Cos^3(A)-7Cos(A)
Thanks, I think I found my mistake.
by snar
Mon Feb 19, 2007 2:42 pm
Forum: Volume 5 (500-599)
Topic: 531 - Compromise
Replies: 73
Views: 25547

-zx- wrote:indeed it does. you can compile it as c++.
It doesn't compile on my Microsoft Visual Studio 2005 compiler. You are using non-constant identifiers for declaring arrays.

:-? ???
by snar
Sun Feb 11, 2007 8:01 pm
Forum: Volume 5 (500-599)
Topic: 531 - Compromise
Replies: 73
Views: 25547

Hi,
I tried to test your code on my compiler when I noticed

Code: Select all

int n = a.size(); 
    int m = b.size(); 
    string emo[n+1][m+1]; 

Does it work on your compiler?
by snar
Sun Feb 11, 2007 7:48 pm
Forum: Volume 1 (100-199)
Topic: 164 - String Computer
Replies: 120
Views: 11318

164 Fixed or not?

Hi all, I was trying to solve this probem a year ago, I got WA, but I got AC for 526 which is the same problem as 164, expect the output format. Then I found that it was wrong judged. Did anybody solve this problem? Is it allright, or my solution is really wrong? NOTE: I'm 90% sure that my solution ...
by snar
Mon Feb 05, 2007 10:55 pm
Forum: Volume 107 (10700-10799)
Topic: 10780 - Again Prime? No Time.
Replies: 40
Views: 27319

I've made some modifications in finding prime factors and my solution run in 0.004 sec, but what about 0.002 sec?

Thanks
by snar
Mon Feb 05, 2007 10:09 pm
Forum: Volume 107 (10700-10799)
Topic: 10780 - Again Prime? No Time.
Replies: 40
Views: 27319

Hi all, Here's my algorithm. Let p be a prime factor of m with power q. Then we can find it's power in (n!). It will be s = n/p + n/p^2 + ...+ n/p^k, where p^k<=n and p^(k+1)>n. The answer will be min{s/q | for each p from m}. My solution got AC in 0.018 sec. But 0.002 sec is much faster. dumb dan w...
by snar
Tue Jan 23, 2007 9:19 pm
Forum: Volume 100 (10000-10099)
Topic: 10037 - Bridge
Replies: 84
Views: 24015

10037 Bridge & Indiana Jones Problem

Can anyone tell me what is Indiana Jones Problem and do it have any relation to this problem?
Thanks
by snar
Wed Jul 26, 2006 11:49 am
Forum: Volume 100 (10000-10099)
Topic: 10023 - Square root
Replies: 121
Views: 27523

10023 Square Root

Hi, It seems that my solution is right and fast enough to pass all the tests, but...I got runtime error. Here is my C code. #include <stdio.h> #include <string.h> #include <stdlib.h> #include <ctype.h> #define MAX 1003 int scan ( char** A ) { int n; char c; c = getchar ( ); while (isspace (c)) c = g...
by snar
Fri Jul 21, 2006 2:56 pm
Forum: Algorithms
Topic: O(log n) Fibonacci
Replies: 4
Views: 2751

O(log n) Fibonacci

Can anyone explain me O(log n) Fibonacci method?
--
Thanks
--

Go to advanced search