Search found 150 matches

by plamplam
Thu Sep 22, 2011 9:13 pm
Forum: Volume 113 (11300-11399)
Topic: 11321 - Sort! Sort!! and Sort!!!
Replies: 50
Views: 21337

Re: 11321 - Sort! Sort!! and Sort!!!

And a whole lot of inputs... 100 1 98996523 702138029 966844567 -866845910 -617887192 1929179531 -722252290 -494624710 -897196254 -1995391956 289115659 -2098754920 1057895599 -1771772912 1563686945 -1709067956 -1989092828 -187112734 -640506788 172581791 -2095032708 -2118368114 1336775175 1572992475 ...
by plamplam
Thu Sep 22, 2011 8:45 am
Forum: Volume 2 (200-299)
Topic: 202 - Repeating Decimals
Replies: 82
Views: 12350

Re: UVA 202

Code: Select all

15 3
1 2971

Code: Select all

15/3 = 5.(0)
   1 = number of digits in repeating cycle

1/2971 = 0.(00033658700774150117805452709525412319084483338943...)
   2970 = number of digits in repeating cycle

by plamplam
Thu Sep 22, 2011 8:44 am
Forum: Volume 2 (200-299)
Topic: 202 - Repeating Decimals
Replies: 82
Views: 12350

Re: 202-why WA?

Code: Select all

15 3
1 2971

Code: Select all

15/3 = 5.(0)
   1 = number of digits in repeating cycle

1/2971 = 0.(00033658700774150117805452709525412319084483338943...)
   2970 = number of digits in repeating cycle

by plamplam
Fri Sep 16, 2011 6:47 pm
Forum: Volume 116 (11600-11699)
Topic: 11623 - Tic Tac Toe
Replies: 6
Views: 3879

Re: 11623 - Tic Tac Toe

TLE = Time Limit Exceeded!!! I thought everyone knew what TLE means :(
by plamplam
Sat Sep 10, 2011 11:04 pm
Forum: Volume 102 (10200-10299)
Topic: 10212 - The Last Non-zero Digit.
Replies: 63
Views: 31814

Re: 10212 - The Last Non Zero Digit

I am yet to get Accepted in this problem-.- :oops: I tested my code with several large random numbers and compared my output against uvatoolkit. I handled cases where n or m is 0 and although my brute force algorithm sucks, it should not, by any means, get Wrong Answer. Okay enough yelling, here are...
by plamplam
Sat Sep 10, 2011 6:22 pm
Forum: Volume 1 (100-199)
Topic: 195 - Anagram
Replies: 242
Views: 29217

Re: 195: anagram, wrong answer

by Shafaet_du » Fri Oct 01, 2010 10:37 pm next permutation function wont be able to solve it. STL is too slow. again suppose the string is aaaaaaaaaaaaaaa. thats 15 characters,but ans is only one line, "aaaaaaaaaaaaaaa". If you use STL and hashtable to eliminate the duplicates it will stil genarate...
by plamplam
Thu Sep 08, 2011 9:10 pm
Forum: Volume 104 (10400-10499)
Topic: 10427 - Naughty Sleepy Boys
Replies: 35
Views: 21595

Re: 10427 - Naughty Sleepy Boys

You can simply solve this using brute force. May be there is a smarter way to get lower runtime but I am too lazy to figure it out as I got Accepted. My code got Accepted in 0.572(not a good runtime but whatever). Just use a character array to precalculate and print the N-th(or (N-1)-th, depending o...
by plamplam
Thu Sep 01, 2011 8:07 pm
Forum: Volume 116 (11600-11699)
Topic: 11623 - Tic Tac Toe
Replies: 6
Views: 3879

Re: 11623 - Tic Tac Toe

How to solve this problem? I solved 10363 but I am getting TLE for this one(11623). Please can someone describe an efficient algorithm? I just store the input as a table in a 2D array and compare vertically, horizontally and diagonally to check if the counter reaches/exceeds m. My program can handle...
by plamplam
Thu Sep 01, 2011 7:07 pm
Forum: Volume 103 (10300-10399)
Topic: 10363 - Tic Tac Toe
Replies: 54
Views: 25171

Re: 10363 - Tic Tac Toe

34 XXX XOO XOO OXX XOO XXO X.. X.. X.. X.. X.. O.. X.X ... .X. O.O ... .O. X.O XO. XOX X.O XOO XXX OXO XXX OXO XXX .O. .O. OOO .X. .X. XOX OXO XOX XXX OOO X.O X.O ..X X.. X.X .OO XOO X.X OO. X.X X.O O.X X.O X.O OO. XXX X.O O.X OOX X.O O.. XXO X.O O.O X.. ... ... ... ... .X. ... ... .O. ... OO. XXO ...
by plamplam
Tue Aug 30, 2011 4:07 pm
Forum: Volume 3 (300-399)
Topic: 362 - 18,000 Seconds Remaining
Replies: 75
Views: 27243

Re: 362 - IO tricky samples

One of the worst problems I've seen here :oops: :oops: I feel like kicking my monitor-.- Thanks a lot for the snippet @Shafaet_DU. Thanks to sijan too. Finally got Accepted. :x
by plamplam
Mon Aug 29, 2011 12:26 pm
Forum: Volume 111 (11100-11199)
Topic: 11105 - Semi-prime H-numbers
Replies: 16
Views: 12107

Re: 11105 - Semi-prime H-numbers

Uvatoolkit's output for this problem is wrong. Don't get confused if you try it. Here are some inputs: 10 100 1000 10000 100000 1000000 0 10 0 100 5 1000 82 10000 980 100000 10394 1000000 105752 You can use sth like sieve and modify it to fit the definition of H numbers. I got Accepted in 0.020s.
by plamplam
Sun Aug 28, 2011 8:44 pm
Forum: Volume 3 (300-399)
Topic: 332 - Rational Numbers from Repeating Fractions
Replies: 83
Views: 21409

Re: 332 - Rational Numbers from Repeating Fractions

I really like this problem(May be because I got AC in first try :P). You can solve this very simply. I'll explain with an example. Consider the input 2 0.318. Here, j = 2, and k = 1. You can approximate X to be 0.318 and use it in the formula but there is a better way. Take the double number as stri...
by plamplam
Sun Aug 28, 2011 3:30 pm
Forum: Volume 103 (10300-10399)
Topic: 10323 - Factorial! You Must be Kidding!!!
Replies: 106
Views: 33737

Re: 10323 - Factorial! You Must be Kidding!!!

Check these lines:

if(n%2==0)
printf("Underflow!\n");
else
printf("Overflow\n");
}

You forgot to include a factorial for Overflow.
It should be Overflow!
by plamplam
Sun Aug 28, 2011 2:06 pm
Forum: Volume 9 (900-999)
Topic: 944 - Happy Numbers
Replies: 20
Views: 13095

Re: 944 - Happy number

I disagree. I didn't even consider that line. (Although you need that line and even more if you aim to get a spot in the top 20) There is a smarter and simpler solution. I just used simple brute force to store all the happy numbers and the number of iterations required(if any) in 2 arrays. However y...
by plamplam
Wed Aug 17, 2011 5:47 pm
Forum: Volume 116 (11600-11699)
Topic: 11660 - Look-and-Say sequences
Replies: 1
Views: 1794

Re: 11660

Thanks a lot for the input. I finally figured it out...smart way to solve this problem. You input really helped. thanks again :)

Go to advanced search