Search found 16 matches

by Ahmad
Tue Aug 21, 2012 9:01 pm
Forum: Volume 108 (10800-10899)
Topic: 10862 - Connect the Cable Wires
Replies: 14
Views: 7906

Re: 10862 - Connect the Cable Wires

**SPOILER** there is a simple dp solution the state is (n,last) where n is the number of hourses left and last is wether the previous house is connected or not now each i have 3 choices to made 1.connect the current house with the center 2. connect the current house with the next house 3. if the pre...
by Ahmad
Mon Jan 30, 2012 10:23 pm
Forum: Volume 100 (10000-10099)
Topic: 10069 - Distinct Subsequences
Replies: 26
Views: 11388

Re: 10069 - Distinct Subsequences

My Acc prog gives the following o/p for these cases 2 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
by Ahmad
Sun Sep 11, 2011 10:27 pm
Forum: Volume 110 (11000-11099)
Topic: 11086 - Composite Prime
Replies: 33
Views: 17532

Re: 11086 - Composite Prime

if you really understand what sieve is doing then it's a very easy problem ...
just do sieve 2 times ... (more explanation would be spoiler )
i just reimplemented sieve with small changes and i got rank 5 in this problem after small optimization of my code ...
by Ahmad
Sat Sep 10, 2011 4:37 pm
Forum: Volume 100 (10000-10099)
Topic: 10061 - How many zero's and how many digits ?
Replies: 43
Views: 21113

Re: 10061 - How Many Zeros and How Many Digits?

there is a very simple Algorithm to get the number of zeros without making any prime factoring ... All what we have to do is finding how many times the base divides the factorial ... we can do it in O(n) but we will have to avoid the overflow ... that's where the modulus part comes ... and i will le...
by Ahmad
Tue Aug 16, 2011 11:30 pm
Forum: Volume 6 (600-699)
Topic: 657 - The die is cast
Replies: 46
Views: 21239

Re: 657 - The die is cast

for people who's still getting WA even with the previous I/O is OK
try this case ...

Code: Select all

10 2
..X**X***X
..XXXX....

ur output may be
1 1
but the right answer is
2

hope this helps ;)
by Ahmad
Tue Aug 16, 2011 7:30 pm
Forum: Volume 1 (100-199)
Topic: 166 - Making Change
Replies: 31
Views: 5540

Re: I need some I/O for 166(making change), plz help

According to my Acc prog the Ans is 4 5 2 3 4 3 5 4 4 3 1 2 2 1 3 3 4 4 7 4 4 1 3 3 2 1 5 2 4 2 5 3 2 6 4 9 3 3 3 2 3 3 1 2 2 3 4 3 3 3 1 1 4 6 2 3 3 3 3 2 4 4 3 3 4 2 2 4 4 2 2 3 2 3 4 4 5 1 4 2 5 5 4 2 3 3 4 5 4 4 3 4 4 2 3 2 3 4 4 2 3 4 6 5 4 3 2 2 5 3 1 2 3 3 3 5 3 2 4 2 4 3 3 1 4 3 3 4 2 3 5 3 ...
by Ahmad
Thu Jul 14, 2011 4:18 pm
Forum: Volume 5 (500-599)
Topic: 573 - The Snail
Replies: 45
Views: 18991

Re: 573 The Snail Why WA ?

i have a question guys ... how can i get this 0.000 time ?!
by Ahmad
Thu Jul 14, 2011 4:10 pm
Forum: Volume 5 (500-599)
Topic: 573 - The Snail
Replies: 45
Views: 18991

Re: 573 The Snail Why WA ?

dennywithy wrote:why i get wrong output at this test:
from the problem statement
(The distance lost to fatigue is always 10% of the first day's climbing distance.)

keep this in mind ;)
by Ahmad
Sun Jul 10, 2011 10:38 pm
Forum: Volume 4 (400-499)
Topic: 495 - Fibonacci Freeze
Replies: 222
Views: 29554

Re: 495 - Fibonacci Freeze

can someone tell me why i was getting TLE when my array was for the first 5000 and when i changed it to 5050 it worked in 0.6 ?!!?!?!!?!
by Ahmad
Sun Jul 10, 2011 4:07 am
Forum: Volume 114 (11400-11499)
Topic: 11415 - Count the Factorials
Replies: 11
Views: 4994

Re: 11415 - Count the Factorials

Hi, to solve this problem u need a clever way to generate the number of factors of factorial -( solve the problem 884)- for each number in the range 1 -> 10 000 000 ... maybe the Algorithm used in the problem 884 isn't enough for this problem.... but it will help you to of course. then it's easy to ...
by Ahmad
Fri Jul 08, 2011 1:36 am
Forum: Volume 100 (10000-10099)
Topic: 10035 - Primary Arithmetic
Replies: 328
Views: 55942

Re: 10035 - Primary Arithmetic

for anyone keep getting WA
just take care of the 'S' in case the output is greater than or equal to 1
and try this case:
Input:

Code: Select all

999743 859
Output:

Code: Select all

6 carry operations.
Ahmad
by Ahmad
Sun Jul 03, 2011 5:19 pm
Forum: Volume 100 (10000-10099)
Topic: 10083 - Division
Replies: 12
Views: 5786

Re: 10083 - Division

it would be great if zoranh (or anyone) helped us by the Mathematical principle behind this conditions to check .... this is why we solve such problems i guess .. to learn :)
by Ahmad
Sun May 01, 2011 7:32 pm
Forum: Volume 5 (500-599)
Topic: 543 - Goldbach's Conjecture
Replies: 109
Views: 23535

543

someone tell me why am getting wrong answer or i will sucide here's the java code import java.util.Scanner; public class Main{ public static void main(String[] args) { int r = 1000000; boolean[] visited = new boolean[r+1]; for (int i = 2; i < r; i++) { if (!visited[i]) { for (int j = 2; i * j < r; j...
by Ahmad
Sun May 01, 2011 3:28 pm
Forum: Volume 4 (400-499)
Topic: 406 - Prime Cuts
Replies: 187
Views: 21801

406 - prime cuts ... WA ?!?!??!!?!?!??!

i think the problem is about the i/o ... so please help me cuz i'm not able to figure it out
i tested my code alot of times and i always find the expected answer ...
here is my implementation using java

Code: Select all

Accepted
by Ahmad
Sun May 01, 2011 1:26 pm
Forum: Volume 4 (400-499)
Topic: 406 - Prime Cuts
Replies: 187
Views: 21801

406-prime cuts WA why !!!!!!!!!!!!

i think the problem is about the i/o ... so please help me cuz i'm not able to figure it out
here is my implementation using java

Code: Select all

Accepte...d

Go to advanced search