Skip to content

Commit

Permalink
Problema: 3100
Browse files Browse the repository at this point in the history
  • Loading branch information
lrlucena committed Nov 9, 2024
1 parent f6166ca commit fcaeff6
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![Join the chat at https://gitter.im/potigol/Potigol](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/potigol/Potigol?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Follow us](https://img.shields.io/twitter/follow/potigol.svg?style=social)](http://twitter.com/potigol)
[![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/potigol/beecrowd)
[![Soluções](https://img.shields.io/badge/Problemas%20Resolvidos-818-blue)](https://github.com/potigol/beecrowd/commits/master)
[![Soluções](https://img.shields.io/badge/Problemas%20Resolvidos-820-blue)](https://github.com/potigol/beecrowd/commits/master)

<!-- a href="https://potigol.github.io/docs/hacktoberfest"><img src="https://hacktoberfest.digitalocean.com/_nuxt/img/logo-hacktoberfest-full.f42e3b1.svg" width=250></a -->

Expand Down
4 changes: 2 additions & 2 deletions categorias/adhoc.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Ad-Hoc (257 / 892)
# Ad-Hoc (258 / 892)



Expand Down Expand Up @@ -183,6 +183,7 @@
- [x] [2601](https://www.beecrowd.com.br/repository/UOJ_2601.html) - [Tustin e Seu Dado Antigo](https://github.com/potigol/beecrowd/blob/master/src/2600/2601.poti)
- [x] [2650](https://www.beecrowd.com.br/repository/UOJ_2650.html) - [Construindo Muralhas](https://github.com/potigol/beecrowd/blob/master/src/2600/2650.poti)
- [x] [2679](https://www.beecrowd.com.br/repository/UOJ_2679.html) - [Sucessor Par](https://github.com/potigol/beecrowd/blob/master/src/2600/2679.poti)
- [x] [2790](https://www.beecrowd.com.br/repository/UOJ_2790.html) - [Dados](https://github.com/potigol/beecrowd/blob/master/src/2700/2790.poti)
- [x] [2803](https://www.beecrowd.com.br/repository/UOJ_2803.html) - [Estados do Norte](https://github.com/potigol/beecrowd/blob/master/src/2800/2803.poti)
- [x] [2830](https://www.beecrowd.com.br/repository/UOJ_2830.html) - [Copa](https://github.com/potigol/beecrowd/blob/master/src/2800/2830.poti)
- [x] [2831](https://www.beecrowd.com.br/repository/UOJ_2831.html) - [Pesos](https://github.com/potigol/beecrowd/blob/master/src/2800/2831.poti)
Expand Down Expand Up @@ -643,7 +644,6 @@
- [ ] [2776](https://www.beecrowd.com.br/repository/UOJ_2776.html) - Promoções
- [ ] [2788](https://www.beecrowd.com.br/repository/UOJ_2788.html) - Aula
- [ ] [2789](https://www.beecrowd.com.br/repository/UOJ_2789.html) - Crise Hídrica
- [ ] [2790](https://www.beecrowd.com.br/repository/UOJ_2790.html) - Dados
- [ ] [2793](https://www.beecrowd.com.br/repository/UOJ_2793.html) - HM
- [ ] [2794](https://www.beecrowd.com.br/repository/UOJ_2794.html) - Montes Claros
- [ ] [2795](https://www.beecrowd.com.br/repository/UOJ_2795.html) - Palíndromo
Expand Down
4 changes: 2 additions & 2 deletions categorias/strings.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Strings (77 / 149)
# Strings (78 / 149)



Expand Down Expand Up @@ -73,6 +73,7 @@
- [x] [2906](https://www.beecrowd.com.br/repository/UOJ_2906.html) - [Database of Clients](https://github.com/potigol/beecrowd/blob/master/src/2900/2906.poti)
- [x] [3038](https://www.beecrowd.com.br/repository/UOJ_3038.html) - [Carta de Natal Criptografada](https://github.com/potigol/beecrowd/blob/master/src/3000/3038.poti)
- [x] [3088](https://www.beecrowd.com.br/repository/UOJ_3088.html) - [Correção de Texto](https://github.com/potigol/beecrowd/blob/master/src/3000/3088.poti)
- [x] [3100](https://www.beecrowd.com.br/repository/UOJ_3100.html) - [Os Dígitos da Sorte](https://github.com/potigol/beecrowd/blob/master/src/3100/3100.poti)
- [x] [3103](https://www.beecrowd.com.br/repository/UOJ_3103.html) - [Número da Sorte](https://github.com/potigol/beecrowd/blob/master/src/3100/3103.poti)
- [x] [3141](https://www.beecrowd.com.br/repository/UOJ_3141.html) - [Dúvida Etária](https://github.com/potigol/beecrowd/blob/master/src/3100/3141.poti)
- [x] [3159](https://www.beecrowd.com.br/repository/UOJ_3159.html) - [Tijolão](https://github.com/potigol/beecrowd/blob/master/src/3100/3159.poti)
Expand Down Expand Up @@ -147,7 +148,6 @@
- [ ] [2975](https://www.beecrowd.com.br/repository/UOJ_2975.html) - Anel
- [ ] [3080](https://www.beecrowd.com.br/repository/UOJ_3080.html) - Proteja os Dados
- [ ] [3083](https://www.beecrowd.com.br/repository/UOJ_3083.html) - Emreh, Liug E As Strings
- [ ] [3100](https://www.beecrowd.com.br/repository/UOJ_3100.html) - Os Dígitos da Sorte
- [ ] [3118](https://www.beecrowd.com.br/repository/UOJ_3118.html) - Bactérias, Suas Loucas!
- [ ] [3143](https://www.beecrowd.com.br/repository/UOJ_3143.html) - Fugindo do Celular
- [ ] [3180](https://www.beecrowd.com.br/repository/UOJ_3180.html) - Roubo de Código
Expand Down
4 changes: 2 additions & 2 deletions src/2700/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Problemas 2700 (46%)
# Problemas 2700 (47%)

- [ ] [2700](https://www.beecrowd.com.br/repository/UOJ_2700.html) - Angariando Fundos *Estruturas e Bibliotecas*
- [ ] [2701](https://www.beecrowd.com.br/repository/UOJ_2701.html) - Portas da Incerteza *Ad-Hoc*
Expand Down Expand Up @@ -90,7 +90,7 @@
- [x] [2787](https://www.beecrowd.com.br/repository/UOJ_2787.html) - [Xadrez](https://github.com/potigol/beecrowd/blob/master/src/2700/2787.poti) *Iniciante*
- [ ] [2788](https://www.beecrowd.com.br/repository/UOJ_2788.html) - Aula *Ad-Hoc*
- [ ] [2789](https://www.beecrowd.com.br/repository/UOJ_2789.html) - Crise Hídrica *Ad-Hoc*
- [ ] [2790](https://www.beecrowd.com.br/repository/UOJ_2790.html) - Dados *Ad-Hoc*
- [x] [2790](https://www.beecrowd.com.br/repository/UOJ_2790.html) - [Dados](https://github.com/potigol/beecrowd/blob/master/src/2700/2790.poti) *Ad-Hoc*
- [x] [2791](https://www.beecrowd.com.br/repository/UOJ_2791.html) - [Feijão](https://github.com/potigol/beecrowd/blob/master/src/2700/2791.poti) *Iniciante*
- [ ] [2792](https://www.beecrowd.com.br/repository/UOJ_2792.html) - Golnaldinho *Estruturas e Bibliotecas*
- [ ] [2793](https://www.beecrowd.com.br/repository/UOJ_2793.html) - HM *Ad-Hoc*
Expand Down
16 changes: 16 additions & 0 deletions src/3100/3100.poti
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
encontrar_primeiro_sete(s: Texto) = se s.posição('7') > 0
então s.posição('7') - 1
senão s.tamanho
fim

ordenar(s: Texto)
primeiro_sete = encontrar_primeiro_sete(s)
parte_antes_7 = s.pegue(primeiro_sete).ordene
parte_depois_7 = s.descarte(primeiro_sete)
sem_5s = parte_depois_7.selecione(_ <> '5')
apenas_5s = "5" * (parte_depois_7.tamanho - sem_5s.tamanho)
retorne parte_antes_7 + apenas_5s + sem_5s
fim

s = leia_texto
escreva ordenar(s)
4 changes: 2 additions & 2 deletions src/3100/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Problemas 3100 (42%)
# Problemas 3100 (43%)

- [ ] [3100](https://www.beecrowd.com.br/repository/UOJ_3100.html) - Os Dígitos da Sorte *Strings*
- [x] [3100](https://www.beecrowd.com.br/repository/UOJ_3100.html) - [Os Dígitos da Sorte](https://github.com/potigol/beecrowd/blob/master/src/3100/3100.poti) *Strings*
- [ ] [3101](https://www.beecrowd.com.br/repository/UOJ_3101.html) - Famílias Poligâmicas *Grafos*
- [x] [3102](https://www.beecrowd.com.br/repository/UOJ_3102.html) - [Kikoho](https://github.com/potigol/beecrowd/blob/master/src/3100/3102.poti) *Matemática*
- [x] [3103](https://www.beecrowd.com.br/repository/UOJ_3103.html) - [Número da Sorte](https://github.com/potigol/beecrowd/blob/master/src/3100/3103.poti) *Strings*
Expand Down
8 changes: 4 additions & 4 deletions src/3200/3225.poti
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
n = leia_inteiro
a, c = leia_inteiros(" ").mutavel
var b := Lista(n, 0).mutável

var b := Lista(n, 0).mutável
para i de 1 até n faça
b[a[i]] := c[i]
fim

var visto := Lista(n, falso).mutável
var trocas := n
var possivel := n mod 2 == 0
para i de 1 até n se não visto[i] faça
trocas := trocas - 1
possivel := não possivel
var j := i
enquanto não visto[j] faça
visto[j] := verdadeiro
j := b[j]
fim
fim

escreva (se trocas mod 2 == 0 então "Possible" senão "Impossible" fim)
escreva (se possivel então "Possible" senão "Impossible" fim)

0 comments on commit fcaeff6

Please sign in to comment.