Latest Entries »

406 – Prime cuts

Problem description, Inputs and Outputs:

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=6&page=show_problem&problem=347

 

Well in this problem you need only 3 things:

1) if the amount of prime numbers in that range is even or odd

2)if C is bigger than half N

3)a list with all the primes you need

 

the only “tricky” part here would be:

lets call “x” the center of the primes that are going to be printed.

if the amount of primes is even then, starting at (x – C ) you print c*2 numbers

if the amount of primes is odd then, starting at (x – C – 1) you print (c*2) – 1 numbers

and also you need to remember that if the value of C is bigger than the half of the amount of primes you print all of them.

View full article »

Prime numbers

Hi there, today we’re gonna talk about “Prime Numbers”.

First, What is a prime number?

An informal definition is any integer greater o equal to 2 that is divisible just by 2 numbers, one and the number itself.

View full article »

Class #2 (11 – Dec – 2010)

UPDATE: Sorry i forgot to attach the pptx :D , but now is here.

Well in this class we will talk about RECURSION.

The recursion is soo important cause you will use it in a lot of algorithms from searching and sorting to traveling a tree and much more, this is the way you can make your programs a little more smarter than usual.

ACM TRAINING COURSE 2

11608 – No Problem

Problem Description, Input and Output:

http://uva.onlinejudge.org/index.php?option=onlinejudge&Itemid=8&category=78&page=show_problem&problem=2655

 

Well, like the name says “No problem”, all you have to do is verify if you have enough problems to make a contest or not.

You start having N amount of problems and each month you have X more problems to use, but they can only be used it on the next month. If you do not have the necessary amount of problems then you print “No problem. :( ” and thats all, but if you have the necessary amount of problems then you print “No problem! :D ” and also you need to substract that number of problems from

View full article »

Problem Description, Input and Output:

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=7&page=show_problem&problem=535

 

This problem is kind of easy, the only thing you need to know is how is the data store into the memory. For example:

if you do this x = 1 what  would be store would be(if x is a signed int)

Less significant >>  >>>  >> >> >>> >>> more significant

00000001      00000000      00000000      00000000


i separated the number in group of 8 cause that’s a BYTE (1 BYTE = 8 BITS). Then all you have to do is insted of having

View full article »

941 – Permutations

Problem:

Given a string S (with up to 20 characters, all lowercase letters) and a integer N (0<=N<20!) find the (N+1)th smallest element of the permutation of S (consider the lexicographic order; the permutation of ‘abc’ above, for example, is represented in lexicographic order form left to right).

E.g., if S = “abc” and N=0, then the result would be “abc”

E.g., if S = “abc” and N=5, then the result would be “cba”

E.g., if S = “abc” and N=3, then the result would be “bca”

E.g., if S = “cba” and N=3, then the result would be “bca”

Notice that the string may not be initially sorted (check the last two examples).

Sample Input

2
abc
3
abcde
119

Sample Output

bca
edcba
 View full article »

10420 – List of Conquests

Problem Description, Input and Output:

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1361

Well in this one the only thing we need to care about is the name of the “country” (CASE SENSITIVE) NOT the name of the chicks (CAN BE NULL). the way i solve it, it was using a map with a string and int values. the string for the name, that would be the key and the int to add 1 each time it repeats.

View full article »

Art of Programming Contest – eBook

This is a great book to start on your way to be a competitive programmer, in this book you will find tips to solve some of the common problems that you will find at http://uva.onlinejudge.org/. Also is a great study guide for the ACM contest.

this is the content of this book:

Chapter 1 Fundamental

Concepts

Chapter 2 Game Plan For a Contest

Chapter 3 Programming In C: a Tutorial

Chapter 4 Essential Data Structures for Contest

Chapter 5 Input/Output Techniques

View full article »

Class #1 (20-Nov-2010)

The topics of this class are:

  1. Data Types
  2. Inputs
  3. Outputs

Here you can find the must used I/O functions and how they work (parameters they receive, return values, flags, etc… ), you will see that depending on the problem your facing, you need to read the input in a different way and the same for the output. If you know the difference between the functions you can choose witch one to use for that case.

You can see the presentation here: ACM TRAINING COURSE #1

10363 – Tic Tac Toe

Problem Description, Input and Output:

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1304

 

This one is kind of tricky, i took me a few mistakes before i realize what was wrong :D

Well few tips you need to focus on:

1) if both of the players (X and O) wins then is “no”

2)if X wins then the Number of X’s must be equal to the Number of O’s plus 1 ( X == (O + 1))

View full article »

Follow

Get every new post delivered to your Inbox.