We’re excited to announce Google Code Jam 2009, this year’s iteration
of Google’s annual programming competition, which offers coders from
around the world an opportunity to solve complex algorithmic problems
under time pressure, using the programming languages and tools of
their choice.
The contest will have a new format this year, starting with online
rounds and ending in a 25-person final in our Mountain View,
California headquarters. We’re still choosing exact times for
everything, but for planning purposes we wanted to give you this
tentative schedule. Please note that the timing may change:
Early-Mid August: Registration will open.
+4 Weeks: Qualification round
+1 Week: Rounds 1A, 1B, 1C
+1 Week: Round 2
+1 Week: Round 3
November: World Finals in Mountain View
Online rounds begin soon, so start practicing!
The Google Code Jam Team
http://code.google.com/codejam.
Digamos que você tenha uma imagem na proporção 1280×850 px, vamos chamar essa imagem de original, e deseja fazer o redimensionamento proporcional para uma imagem nas medidas aproximadas de 408×544 px, que será chamada de final.
Exemplificando:
- Imagem original: 1280×850
- Imagem final (aproximada): 408×544
Algoritmo:
1
2
3
4
5
6
7
8
9
10
11
12
13
| inicio
escala_largura = largura_original / largura_final
escala_altura = altura_original / altura_final
se escala_largura < escala_altura
escala = escala_largura
senao
escala = escala_altura
fim se
largura_proporcional = largura_original / escala
altura_proporcional = altura_original / escala
fim |
Teste:
1
2
3
4
5
6
7
8
9
10
11
12
13
| inicio
escala_largura = 1280 / 408 #3,137254902
escala_altura = 850 / 544 #1,5625
se escala_largura < escala_altura
escala = escala_largura
senao
escala = escala_altura
fim se
largura_proporcional = 1280 / 1,5625 #819,2
altura_proporcional = 850 / 1,5625 #544
fim |
Esse teste gerá uma imagem proporcional de medidas 819,2×544 px.
Esse algoritmo leva em consideração que a imagem original sempre vai ser maior.
Tags:
Algoritmo,
divisão,
escala,
fazer,
fim,
imagem,
imagem final,
imagem original,
imagens,
inicio,
proporção,
proporcionalmente,
redimensionamento,
se,
sourcecode