## Search found 99 matches

Thu Feb 03, 2011 2:17 pm
Forum: Volume 100 (10000-10099)
Topic: 10090 - Marbles
Replies: 43
Views: 22372

### Re: 10090 - Marbles

Try these

Input:

Code: Select all

``````1791
2000000000 13
1 21
1791
1 21
10 13
1791
10 21
1 13
1791
1 13
10 21
1791
10 13
1 21
1
10 3
1 2
1
1 2
10 3
0
``````
Output:

Code: Select all

``````15 76
76 15
11 120
120 11
15 76
failed
failed
``````
Thu Feb 03, 2011 1:11 am
Forum: Volume 102 (10200-10299)
Topic: 10290 - {Sum+=i++} to Reach N
Replies: 27
Views: 12706

### Re: 10290 - {sum+=i++} to Reach N

I used sieve for generating primes upto sqrt(9e14) (only this takes around 0.9 secs)
Then I calculate number of odd divisors for each given number.
The total time it took was more than 2 secs. I see a lot of people got it AC in < 0.5 secs. Is there any better way of solving this?
Thu Mar 01, 2007 1:09 pm
Forum: Volume 100 (10000-10099)
Topic: 10058 - Jimmi's Riddles
Replies: 22
Views: 6414
It is easier to think of critical test cases if you give us overview of your approach. It is a typical Grammar Problem. All other approaches may result in Wrong Answers.
Mon Nov 06, 2006 8:27 pm
Forum: Volume 102 (10200-10299)
Topic: 10294 - Arif in Dhaka (First Love Part 2)
Replies: 10
Views: 4731
I have solved the problem using the Formula provided in http://mathworld.wolfram.com
I wanted to know whether there is any recurrance or DP solution for this problem ...
Mon Nov 06, 2006 8:22 pm
Forum: Volume 4 (400-499)
Topic: 458 - The Decoder
Replies: 71
Views: 15168
There is no breaking condition in your "while" loop ...
try some thing like

Code: Select all

``````while(gets(str))
{
......
......
}
``````
while(1) defines an infinite loop ... while(gets(str)) will break when it reaches End of Input File
Thu Nov 02, 2006 8:40 am
Forum: Volume 100 (10000-10099)
Topic: 10058 - Jimmi's Riddles
Replies: 22
Views: 6414
- the extra words that seem to be in the input (I chose to regard them as wrong rather than ignore them) - the apostroph in the output (I just copied it from the example output, even though it seems to have ascii value > 127) - the "VERBs" in the definition of VERB (I chose to consider a given verb...
Mon Oct 30, 2006 8:45 pm
Forum: Volume 100 (10000-10099)
Topic: 10000 - Longest Paths
Replies: 160
Views: 36478
Your program does not pass the following case: 5 1 1 2 2 3 3 4 1 3 4 5 0 0 About your input I dont think there is any such input in the judge data .. though the logical ans should be (0,5) but my AC code does not pass that as well .. And I agree with Jan .. making new threads for each new problems o...
Mon Oct 30, 2006 9:30 am
Forum: Volume 104 (10400-10499)
Topic: 10466 - How Far?
Replies: 25
Views: 8444
Hello shamim,

Can u plz post some test cases for which the cosine rule may not work ?? I am stuck ... My code seems to work for all the cases that I can think of

Thu Jun 15, 2006 11:54 pm
Forum: Volume 110 (11000-11099)
Topic: 11031 - Looking for a Subset
Replies: 24
Views: 17357
Hi bijon, first of all thanx to you as I used your I/O to get AC

just a hint .. there can be negative values as input ... (at least that was the reason for which I was suffering)
Wed Jun 14, 2006 4:25 pm
Forum: Volume 110 (11000-11099)
Topic: 11028 - Sum of Product
Replies: 24
Views: 12883
Hi .. I have wasted a whole today thinking about a traditional solution to this problem ... is GOOGLE the only solution to this problem ??? If anyone has solved it with some other way plz can u share your algo ?? And I completely agree with Darko .. GOOGLE is an english verb now (at least for us :wi...
Sun Jun 11, 2006 9:30 pm
Forum: Volume 110 (11000-11099)
Topic: 11036 - Eventually Periodic Sequence
Replies: 22
Views: 6361
Hi, Thanks to mf for mentioning the Floyd's Algorithm. It was really a nice algo and I have just got AC .. but the timing came really bad (about 4 sec). I had a few questions: 1. Well .. according to wiki .. I made two iterations and calculated the GCD to get the actual period. Is there any better w...
Tue Jun 06, 2006 5:53 pm
Forum: Volume 110 (11000-11099)
Topic: 11045 - My T-shirt suits me
Replies: 18
Views: 10323
rammestain wrote:I tried to solve this problem with dynamic programming but got TLE
I have solved the problem using memoization.

visited[a][c][d][e][f] becomes true when I have tried giving 'a' no of XS, 'b' no of S .... 'f' no of XXL t-shirts
Tue Jun 06, 2006 5:40 pm
Forum: Volume 110 (11000-11099)
Topic: 11042 - Complex, difficult and complicated
Replies: 20
Views: 13761
When you convert the number to polar form ... then

SPOILER
(a+ib)^n
= r^n (cos (n.t) + i sin (n.t) )

You can safely say that if r^n is greater than 2^30 then TOO COMPLICATED
Sat Mar 25, 2006 8:16 pm
Forum: Volume 100 (10000-10099)