Search found 26 matches

by alirezanoori
Wed Jun 17, 2009 10:40 am
Forum: Algorithms
Topic: UCS
Replies: 3
Views: 3410

Re: UCS

Well, UCS stands for Uniform Cost Search and is a graph search algorithm just like BFS (Breadth First Search) but with keeping cost in mind. So it's just like BFS but with a difference that it does not expand the shallowest node, but it expands the node with the lowest cost. I don't have any impleme...
by alirezanoori
Wed Jun 10, 2009 9:40 am
Forum: Volume 108 (10800-10899)
Topic: 10883 - Supermean
Replies: 30
Views: 11933

Re: 10883 - Supermean

Well, I changed my code to this, still WA! long double newComb(long double oldLog, int n, int i) { if(i == 0) return log(1.0); if((n + 1 - i) == 0) return log(1.0); long double log2 = log((long double)(i)); long double log1 = log((long double)(n + 1 - i)); long double newLog = oldLog + log1 - log2; ...
by alirezanoori
Mon Jun 08, 2009 3:20 pm
Forum: Volume 108 (10800-10899)
Topic: 10883 - Supermean
Replies: 30
Views: 11933

Re: 10883 - Supermean

Well, I managed to convert the formula to this format:
result = Sigma exp(log(a) + log(nCi) - (n * pow(2.0))
It works really great for positive numbers, but when it comes to negative numbers, program fails (because of log(a) part).
Any suggestions?
by alirezanoori
Sun Jun 07, 2009 7:37 pm
Forum: Volume 108 (10800-10899)
Topic: 10883 - Supermean
Replies: 30
Views: 11933

Re: 10883 - Supermean

And how could I do that?
by alirezanoori
Sun Jun 07, 2009 11:30 am
Forum: Volume 108 (10800-10899)
Topic: 10883 - Supermean
Replies: 30
Views: 11933

Re: 10883 - Supermean

Hi, I've read these posts and came with a solution, but I have a minor problem with the 2 ^ n part. Could you please take a look at my code and help me? Thanks in advance. #include <iostream> #include <cmath> using namespace std; double arr[50000]; int n; long double newComb(long double oldCm, int n...
by alirezanoori
Thu Mar 12, 2009 11:32 pm
Forum: Volume 1 (100-199)
Topic: 164 - String Computer
Replies: 120
Views: 12251

Re: #164 I think there is a bug in your tests!!!

Of course the problem is wrong! It says "Any solution that satisfies these criteria will be accepted" but its really obvious that it doesn't. I think instead of checking the answer with a program, the judge test your answer with a pre-defined answer that has this priority MATCH-INSERT-DELETE!
by alirezanoori
Wed Mar 04, 2009 7:34 pm
Forum: Bugs and suggestions
Topic: g++ compile error
Replies: 9
Views: 5394

Re: g++ compile error

Thanks alot.
Now I get my WA!!! :))
by alirezanoori
Wed Mar 04, 2009 5:15 pm
Forum: Bugs and suggestions
Topic: g++ compile error
Replies: 9
Views: 5394

Re: g++ compile error

Well, ok.
Here's my code.

Code: Select all

Code Removed.
by alirezanoori
Fri Feb 27, 2009 11:11 pm
Forum: Bugs and suggestions
Topic: g++ compile error
Replies: 9
Views: 5394

Re: g++ compile error

Hi guys. Well, I have a problem. In many of my codes when I use the sort function on a 'user defined' data structure (struct) I get a compilation error from judge!! Why is this happening? I wrote many codes with this feature and I cannot write them again. here is a part of the code that I get Compil...
by alirezanoori
Thu Feb 26, 2009 12:52 pm
Forum: Volume 1 (100-199)
Topic: 154 - Recycling
Replies: 29
Views: 3548

Re: 154 : Recycling

I am getting WA too, and my algorithm is pretty much the same as yours. I debugged my program and it works as expected but I don't know why I am getting WA! I think there is some critical inputs because I am sure this is the right algorithm. If anyone has some critical inputs please post it. If you ...
by alirezanoori
Thu Feb 12, 2009 5:55 pm
Forum: Volume 100 (10000-10099)
Topic: 10006 - Carmichael Numbers
Replies: 66
Views: 21388

Re: 10006 - Carmichael Numbers

Thx alot. I tested my program and here's the bug. I used int for my bigmod function, but turns out that it's not enough. I just used long long and everything worked just fine. Now I got AC.
by alirezanoori
Wed Feb 11, 2009 11:30 pm
Forum: Volume 100 (10000-10099)
Topic: 10006 - Carmichael Numbers
Replies: 66
Views: 21388

Re: 10006 - Carmichael Numbers

well, first of all thanks for your help. I finally understand the problem. I just don't know how I get WA!!! Because I'm almost sure I've done anything OK. I've checked my output format and its OK too. Here's my Fermat function. Removed after AC! If there is ANYTHING wrong with it please let me know...
by alirezanoori
Wed Feb 11, 2009 2:22 pm
Forum: Volume 100 (10000-10099)
Topic: 10006 - Carmichael Numbers
Replies: 66
Views: 21388

Re: 10006 - Carmichael Numbers

I can't understand the problem. Why 17 is Normal? 2^17 mod 17 = 2 3^17 mod 17 = 3 4^17 mod 17 = 4 5^17 mod 17 = 5 6^17 mod 17 = 6 7^17 mod 17 = 7 8^17 mod 17 = 8 9^17 mod 17 = 9 10^17 mod 17 = 10 11^17 mod 17 = 11 12^17 mod 17 = 12 13^17 mod 17 = 13 14^17 mod 17 = 14 15^17 mod 17 = 15 16^17 mod 17 =...
by alirezanoori
Sun Jan 25, 2009 4:53 pm
Forum: Volume 7 (700-799)
Topic: 706 - LCD Display
Replies: 221
Views: 37718

Re: 706 - LC-Display

Well, as I said, I tried both ways and all got WA!
Please tell me what is wrong. I checked all possible ways for input and output. All works.
by alirezanoori
Fri Jan 23, 2009 4:27 pm
Forum: Volume 7 (700-799)
Topic: 706 - LCD Display
Replies: 221
Views: 37718

Re: 706 - LC-Display

Well, I fixed all of that. Still WA. Here's the new code. One thing I don't know is this: I should print a new line after each number and print another one between cases? (One blank line between cases and a new line after each test) or I should print just a blank line between each test case. for exa...

Go to advanced search