This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def mdc(a: int, b: int) -> int: | |
| if b == 0: | |
| return a | |
| else: | |
| return mdc(b, a % b) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void setup() | |
| { | |
| pinMode(2,OUTPUT); | |
| Serial.begin(115200); | |
| Serial.println("Estado do led"); | |
| } | |
| void loop() | |
| { | |
| digitalWrite(2,HIGH); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| :local nomerb; | |
| :set nomerb [/system identity get name]; | |
| :local platform; | |
| :set platform [/system resource get platform]; | |
| :local boardname; | |
| :set boardname [/system resource get board-name]; | |
| :local version; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| :local custLeaseHost; | |
| # Obtém o hostname do dispositivo | |
| :set custLeaseHost [/ip dhcp-server lease get value-name=host-name [/ip dhcp-server lease find active-address="$leaseActIP"]]; | |
| :if ($leaseBound = 1) do={ | |
| # Emite uma mensagem de log | |
| /log warning message="DHCP LEASE UP MAC=$leaseActMAC IP=$leaseActIP hostname=$custLeaseHost"; | |
| # Cria uma queue para o cliente |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def bubble_sort(array): | |
| """Ordena uma lista usando o algoritmo de bolha.""" | |
| n = len(array) | |
| for i in range(n): | |
| # Cria uma flag que irá permitir o algoritmo parar se não houver trocas | |
| already_sorted = True | |
| # Itera sobre todos os elementos da lista | |
| # (exceto o último, pois o algoritmo de bolha compara os elementos atuais com o próximo) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Node: | |
| """ Classe que define as características do nó da árvore""" | |
| def __init__(self, value: int): | |
| self.left = None | |
| self.right = None | |
| self.value = value | |
| class Tree: | |
| """ Classe que define a árvore binária de busca""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| k = 1 | |
| fat = 1 | |
| numero = int(input("Informe um número: ")) | |
| while k <= numero: | |
| fat *= k | |
| k += 1 | |
| print(f"fat({k - 1}) = {fat}") |
NewerOlder