O enunciado dessa questão é bem direto: devemos iterar pela matriz procurando o elemento zero. Note que o enunciado garante que só há um 0 por matriz.
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <ctype.h> | |
void clear_result() { | |
FILE *fp = fopen("result.txt", "w"); | |
fclose(fp); | |
} |
Podemos resolver esse problema utilizando um loop de repetição, como o while. Nesse caso, a solução esperada é realmente ir multiplicando o peso dos ursos até que o peso de Samuelito ultrapasse o de Loppamir, enquanto mantemos um contador para os anos. Então, basta multiplicar o peso dos ursos enquanto o peso de Samuelito for menor ou igual o peso de Loppamir e, a cada multiplicação, somar 1 no tempo. Dessa forma, assim que Samuelito for mais pesado, sairemos do loop.
Código com a solução do problema (Clique para expandir)
#include
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
from selenium import webdriver | |
from selenium.webdriver.common.keys import Keys | |
import time | |
class InstagramBot: | |
def __init__(self, username, password): | |
self.username = username | |
self.password = password | |
self.driver = webdriver.Firefox(executable_path='C:\geckodriver.exe') |
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
#include <bits/stdc++.h> | |
using namespace std; | |
char** create_pop(int pop_size, int numberOfObj) { | |
char** population = (char**) malloc(pop_size * sizeof(char*)); | |
// creates a 'numOfObj' sized string for each position in the population vector | |
for(int i = 0; i < pop_size; i++) { | |
population[i] = (char*) malloc((numberOfObj + 1) * sizeof(char)); | |
} |
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
from bs4 import BeautifulSoup as soup #used to beautifie the html code | |
import datetime as dt #sum the video's duration time | |
from selenium import webdriver #open webdriver for specific browser | |
from selenium.webdriver.common.keys import Keys #for necessary browser action | |
import time #used for sleep function | |
#line 63 must be modified for different languages | |
#line 35 must be modified for different url | |
times = [] |