content
stringlengths
7
1.05M
T = [3614090360, 3905402710, 606105819, 3250441966, 4118548399, 1200080426, 2821735955, 4249261313, 1770035416, 2336552879, 4294925233, 2304563134, 1804603682, 4254626195, 2792965006, 1236535329, 4129170786, 3225465664, 643717713, 3921069994, 3593408605, 38016083, 3634488961, 38894294...
def driver(): list = [] age1 = input("Enter the first number:") age2 = input("Enter the second number:") def swap(num1, num2): if age1 > age2: list.append(age2) list.append(age1) if age1 < age2: list.append(age1) list.append(age2) swap(age1,age2) print("the swapped result (fr...
db_config = { # 'host': 'localhost', # 'port': 1337, # 'unix_socket': '/var/lib/mysql/mysql.sock', 'user': 'root', # 'passwd': 'password, 'db': 'logs_db' }
def Ro_decimal_constr(x_par): """ The function to compute the non linear contraint of the Ro parameter. :param list x_par: list of parameters, beta, r and pop. :return: the Ro value. :rtype: float """ if len(x_par) == 3: return x_par[0] * x_par[2] / x_par[1] else: return x_par...
make_numbers = {'American Motors': 1, 'Jeep/Kaiser-Jeep/Willys Jeep': 2, 'AM General': 3, 'Chrysler': 6, 'Dodge': 7, 'Imperial': 8, 'Plymouth': 9, 'Eagle': 10, 'Ford': 12, ...
a = int(input('Digite o comprimento de uma reta: ')) b = int(input('Digite o comprimento de outra reta: ')) c = int(input('Digite o comprimento de mais uma reta: ')) print(abs(b-c)) if a > abs(b-c) and a < b+c: print('As retas {}, {} e {} formam um triângulo.'.format(a, b, c)) if b > abs(a-c) and b < a+c: print...
def twoNumberSum(array, targetSum): # Write your code here. dic = {} for i in range(len(array)): if targetSum - array[i] in dic: return [array[i], targetSum - array[i]] else: dic[array[i]] = i return []
# Calcular todos em: # KM HM DAM M DM CM MM var = float(input("Digite um valor: ")) print("O valor em decimetro fica {}".format(var * 10)) #DM print("O valor em centimetros fica {}".format(var * 100)) #CM print("O valor e milimetros fica {}".format(var * 1000)) #MM print("O valor em metros fica {}".format(var * 10...
#!/usr/bin/env python3 #encoding=utf-8 #------------------------------------------------ # Usage: python3 simplest_class.py # Description: class attribute and method #------------------------------------------------ class Rec: # Empty namespace object ... if __name_...
class SOG(): """The class for SOG training """ def __init__(self, *args): """Set the training hyper-parameters including the network, the criterion, the optimizer, training epoches, sampling distribution and sampling number etc. Initialize the components here """ pas...
def slices(num_string,slice_size): if slice_size>len(num_string): raise ValueError list_of_slices = [] for i in range(len(num_string)-slice_size+1): temp_answer = [] for j in range(slice_size): temp_answer.append(int(num_string[i+j])) list_of_slices.append(temp_answer) return list_of_slices def l...
global LAYER_UNKNOWN LAYER_UNKNOWN = 'unknown' class Design(object): def __init__(self, layers, smells) -> None: self.layers = layers self.smells = smells super().__init__()
""" Initialization file for tweets library module. These exist here in lib as some of them are useful as help functions of other scripts (such as getting available campaigns). However, these could be moved to utils/reporting/ as individual scripts. And they could be called directly or with make, to avoid having multip...
""" Coin change given coins of different denominations and a total amount of money. Write a function to compute the number of combinations that make up that amount. You may assume that you have infinite number of each kind of coin. Input: amount = 25, coins = [1, 2, 5] """ class Solution: def change(self, amount...
p = float(input('Digite seu peso: ')) a = float(input('Digite sua altura: ')) imc = p / (a**2) if imc <= 18.5: print('Seu imc é {:.2f} você está abaixo do peso'.format(imc)) elif 18.5 < imc <= 25.0: print('Seu imc é {:.2f} você está no peso ideal'.format(imc)) elif 25.0 < imc <= 30.0: print('Seu imc é {:....
class RecentCounter: def __init__(self): self.slide_window = deque() def ping(self, t: int) -> int: self.slide_window.append(t) # invalidate the outdated pings while self.slide_window: if self.slide_window[0] < t - 3000: self.slide_window.po...
# -------------- # Code starts here class_1=['Geoffrey Hinton','Andrew Ng','Sebastian Raschka','Yoshua Bengio'] class_2=['Hilary Mason','Carla Gentry','Corinna Cortes'] new_class=class_1+class_2 print(new_class) new_class.append('Peter Warden') print(new_class) new_class.remove("Carla Gentry") print(new_class) # Cod...
widget = WidgetDefault() widget.border = "None" widget.background = "None" commonDefaults["RadialMenuWidget"] = widget def generateRadialMenuWidget(file, screen, menu, parentName): name = menu.getName() file.write(" %s = leRadialMenuWidget_New();" % (name)) generateBaseWidget(file, screen, menu) ...
def find_divisor(numbers): for index, number in enumerate(numbers): print("len", len(numbers[index + 1:])) for divider in reversed(numbers[index + 1:]): if number % divider == 0: print("found {} and {}. Rest: {}".format( number, divider, number % divid...
class University: def __init__(self, name, country, world_rank): self.name = name self.country = country self.world_rank = world_rank
# FROM ATUS 2016 # ACTIVITY FILE # TUCASEID: ATUS person ID # TUACTIVITY_N: Activity line number # TRTCCTOT_LN: Total time spent during activity providing secondary childcare for all children < 13 (in minutes) # TRTEC_LN: Time spent providing eldercare by activity (in minutes) # TUACTDUR: Duration of activity in minut...
#!/usr/bin/env python class Solution: def copyRandomList(self, head: 'Node') -> 'Node': curr = head while curr: node = Node(curr.val, curr.next, None) curr.next, curr = node, curr.next curr = head while curr: copy = curr.next copy.ran...
valores = list() while True: n = int(input('Digite um valor: ')) if n not in valores: valores.append(n) print('Valor add') else: print('Valor duplicado... não foi add') op = ' ' while op not in 'SN': op = str(input('Deseja continuar [S/N]? ')).strip().upper() if o...
def _responses_path( config: "Config", sim_runner: "FEMRunner", sim_params: "SimParams", response_type: "ResponseType", ) -> str: """Path to fem that were generated with given parameters.""" return sim_runner.sim_out_path( config=config, sim_params=sim_params, ext="npy", response_types=[...
KEY_PRESS = 0 MOUSE_DOWN = 1 MOUSE_UP = 2 MOUSE_DOUBLE_CLICK = 3 MOUSE_MOVE = 5 SCROLL_DOWN = 6 SCROLL_UP = 7 SCROLL_STEP = 1 CTRL = 'ctrl' SHIFT = 'shift' ALT = 'alt' MODIFIER_KEYS = (CTRL, SHIFT, ALT,) MODIFIER_KEYS_PRESS_DELAY = .4 EVENTS_DELAY = .05 LEFT = "left" MIDDLE = "middle" RIGHT = "right" HIGH_QUALIT...
#Celsius to Fahrenheit conversion #F = C *9/5 +32 F= 0 print("Give the Number of Celcius: ") c=float(input()) print("The result is: ") F=c*9/5+32 print(F)
score = float(input("백분위(0~100)점수를 입력해 주세요 >>")) if score <= 30: print("당신의 학점은 A입니다.") elif score <= 70: print("당신의 학점은 B입니다.") else: print("당신의 학점은 C입니다.")
# -*- coding: utf-8 -*- """ ParaMol MM_engines subpackage. Contains modules related to the ParaMol representation of MM engines. """ __all__ = ['openmm', 'resp']
#Software By AwesomeWithRex def read_file(filename): with open(filename) as f: filename = f.readlines() return filename def get_template(): template = '' with open('template.html', 'r') as f: template = f.readlines() return template def put_in_body(file, template): ...
class Node: def __init__(self, data): self.data = data self.next = None class LinkedList: def __init__(self): self.head = None def print_list(self): cur_node=self.head while cur_node: print(cur_node.data) cur_node = cur_node.next def ap...
# -*- coding: utf-8 -*- def in_segregation(x0, R, n, N=None): """ return the actual indium concentration in th nth layer Params ------ x0 : float the indium concentration between 0 and 1 R : float the segregation coefficient n : int the current layer N : int...
class Solution: def angleClock(self, hour: int, minutes: int) -> float: hdeg = ((hour*30) + (minutes*0.5))%360 mdeg = (minutes * 6) angle = abs(hdeg-mdeg) return min(angle, 360-angle)
# Copyright (c) 2010 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'variables': { 'chromium_code': 1, 'protoc_out_dir': '<(SHARED_INTERMEDIATE_DIR)/protoc_out', }, 'targets': [ { # Protobuf comp...
#!/usr/bin/env python # encoding: utf-8 def run(whatweb, pluginname): whatweb.recog_from_file(pluginname, "sysImages/css/PagesCSS.css", "foosun") whatweb.recog_from_file(pluginname, "Tags.html", "Foosun")
# reading withdrawal amount and account balance x,y=map(float,input().split()) # this will check if account balance is less than the withdrawal amount or # withdrawal amount is multiple of 5 and print the current account balance if(x+0.5>=y or x%5!=0 or y<=0): # printing the result upto two decimals print("%.2f"%...
#-------------------------------------- # Open and Parse BF File #-------------------------------------- fileName = input("Enter name of Brainf*** file here: ") file = open(fileName, "r") programCode = [] validCommands = [">", "<", "+", "-", ".", ",", "[", "]"] for x in file: for y in x: if y in validComm...
''' ARIS Author: 𝓟𝓱𝓲𝓵.𝓔𝓼𝓽𝓲𝓿𝓪𝓵 @ 𝓕𝓻𝓮𝓮.𝓯𝓻 Date:<2018-05-18 15:52:50> Released under the MIT License ''' class Struct: def __init__(_,rawdat) : _.__dict__ = rawdat for k,v in rawdat.items() : if isinstance(v,dict): _.__dict__[k] = Struct(v) if ...
_registered_input_modules_types = {} def register(name, class_type): if name in _registered_input_modules_types: raise RuntimeError("Dublicate input module name: " + name) _registered_input_modules_types[name] = class_type def load_modules(agent, input_link_config): input_modules = [] # get in...
def find_missing(array): return [x for x in range(array[0], array[-1] + 1) if x not in array] lst = [2, 4, 1, 7, 10] print(find_missing(lst))
#! /root/anaconda3/bin/python """ @如果一个对象同时实现了特殊方法__iter__()和__next__(),那么该对象也被称为迭代器对象,如果该对象用于for-in语句,for-in语句首先会调用特殊方法__iter__()返回一个可迭代对象,然后不断调用该迭代对象的特殊方法__next__()返回了下一次迭代的值,直到遇到StopIteration时退出循环。 """ class MyIterator(object): def __init__(self): self.data = 0 def __iter__(self): # 我是...
def trigger(): return """ CREATE OR REPLACE FUNCTION trg_mensagem_ticket_solucao() RETURNS TRIGGER AS $$ BEGIN IF (NEW.solucao) THEN UPDATE ticket SET solucionado_id = NEW.id, data_solucao = NOW(), hora_solucao = NOW() WHERE id = NEW.ticket_id; ...
S1 = "Hello Python" print(S1) # Prints complete string print(S1[0]) # Prints first character of the string print(S1[2:5]) # Prints character starting from 3rd t 5th print(S1[2:]) # Prints string starting from 3rd character print(S1 * 2) # Prints string two times print(S1 + "Thanks") # Prints concatenated string
def onSpawn(): while True: pet.moveXY(48, 8) pet.moveXY(12, 8) pet.on("spawn", onSpawn) while True: hero.say("Run!!!") hero.say("Faster!")
def valid_parentheses(parens): """Are the parentheses validly balanced? >>> valid_parentheses("()") True >>> valid_parentheses("()()") True >>> valid_parentheses("(()())") True >>> valid_parentheses(")()") False >>> valid_parentheses("())"...
# TO print Fibonacci Series upto n numbers and replace all prime numbers and multiples of 5 by 0 # Checking for prime numbers def isprime(numb): if numb == 2: return True elif numb == 3: return True else : for i in range(2, numb // 2 + 1): if (numb % i) == 0: ...
class Solution: def reorderLogFiles(self, logs: List[str]) -> List[str]: def corder(log): identifier, detail = log.split(None, 1) return (0, detail, identifier) if detail[0].isalpha() else (1,) return sorted(logs, key=corder)
# -*- coding: utf-8 -*- """ reV Econ utilities """ def lcoe_fcr(fixed_charge_rate, capital_cost, fixed_operating_cost, annual_energy_production, variable_operating_cost): """Calculate the Levelized Cost of Electricity (LCOE) using the fixed-charge-rate method: LCOE = ((fixed_charge_rate * ca...
""" Base Exception MLApp Exception - inherit from Base Exception """ class MLAppBaseException(Exception): def __init__(self, message): self.message = message class FrameworkException(MLAppBaseException): def __init__(self, message=None): if message is not None and isinstance(message, str): ...
""" link: https://leetcode-cn.com/problems/split-array-largest-sum problem: 将 nums 分割成 m 个连续子串,求所有分割方式中,子串集最大值的最小值 solution: 二分。计算分割状态复杂度很高,可以反过来考虑,假设给定解为 x,可以在 O(n) 的时间复杂度内检查nums是否有该解。 所以可以二分枚举解,时间复杂为 O(log(sum(nums)) * n) """ class Solution: def splitArray(self, nums: List[int], m: int) -> int: ...
# initiate empty list to hold user input and sum value of zero user_list = [] list_sum = 0 # seek user input for ten numbers for i in range(10): userInput = input("Enter any 2-digit number: ") # check to see if number is even and if yes, add to list_sum # print incorrect value warning when ValueError ex...
load("@io_bazel_rules_docker//container:pull.bzl", "container_pull") def containers(): container_pull( name = "alpine_linux_amd64", registry = "index.docker.io", repository = "library/alpine", tag = "3.14.2", )
BUILD_STATE = ( ('triggered', 'Triggered'), ('building', 'Building'), ('finished', 'Finished'), ) BUILD_TYPES = ( ('html', 'HTML'), ('pdf', 'PDF'), ('epub', 'Epub'), ('man', 'Manpage'), )
class Solution: def getDecimalValue(self, head: ListNode) -> int: return self.getDecimalValueHelper(head)[0] def getDecimalValueHelper(self, head: ListNode) -> int: if head is None: return (0, 0) total, exp = self.getDecimalValueHelper(head.next) currbit = head.val ...
# Copyright (C) 2009 Duncan McGreggor <duncan@canonical.com> # Copyright (C) 2009 Robert Collins <robertc@robertcollins.net> # Copyright (C) 2012 New Dream Network, LLC (DreamHost) # Licenced under the txaws licence available at /LICENSE in the txaws source. __all__ = ["REGION_US", "REGION_EU", "EC2_US_EAST", "EC2_US_...
""" 224. Basic Calculator Example 1: Input: "1 + 1" Output: 2 Example 2: Input: " 2-1 + 2 " Output: 3 Example 3: Input: "(1+(4+5+2)-3)+(6+8)" Output: 23 """ class Solution: def calculate(self, s): """ :type s: str :rtype: int """ self.stack = [] ...
n = int(input()) for i in range(0, n): line = input() b, p = line.split() b = int(b) p = float(p) calc = (60 * b) / p var = 60 / p min = calc - var max = calc + var print(min, calc, max)
a = int(input('First number')) b = int(input('Second number')) if a>b: print(a) else: print(b)
''' QUESTÃO 1: Desenvolva um gerador de tabuada, capaz de gerar a tabuada de qualquer número inteiro entre 1 a 10. O usuário deve informar de qual numero ele deseja ver a tabuada. A saída deve ser conforme o exemplo abaixo: Tabuada de 5: 5 X 1 = 5 5 X 2 = 10 5 X 3 =30 ... 5 X 10 = 50 Obs: A entrada só deve aceitar de 1...
# Copyright (c) Microsoft Corporation. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
""" RedPocket Exceptions """ class RedPocketException(Exception): """Base API Exception""" def __init__(self, message: str = ""): self.message = message class RedPocketAuthError(RedPocketException): """Invalid Account Credentials""" class RedPocketAPIError(RedPocketException): """Error re...
# pylint: disable=C0111 __all__ = ["test_dataset", "test_label_smoother", "test_noam_optimizer", "test_tokenizer", "test_transformer", "test_transformer_data_batching", "test_transformer_dataset", "test_transformer_positional_encoder", ...
# range(): gera uma faixa de números # range() com 1 argumento: gera uma lista de números # que vai de zero até argumento - 1 for i in range(10): print(i) print('--------------------------------') # range() com 2 argumentos: gera uma lista de números # começando pelo primento argumento (inclusive) até # o segund...
distancia1: float; distancia2: float; distancia3: float; maiorD: float print("Digite as tres distancias: ") distancia1 = float(input()) distancia2 = float(input()) distancia3 = float(input()) if distancia1 > distancia2 and distancia1 > distancia3: maiorD = distancia1 elif distancia2 > distancia3: maiorD = dis...
# # PySNMP MIB module ALTIGA-GLOBAL-REG (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALTIGA-GLOBAL-REG # Produced by pysmi-0.3.4 at Wed May 1 11:21:16 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the...
# 请根据自己的理解编写计数算法,接收如下文字,输出其中每个字母出现的次数,以字典形式输出;(忽略大小写) # 文字内容: # Understanding object-oriented programming will help you see the world as a programmer does. # It will help you really know your code, not just what is happening line by line, but also the bigger concepts behind it. # Knowing the logic behind classes will t...
# Since any modulus should lay between 0 and 101, we can record all # possible modulus at any given point in the calculation. The possible # set of values of next step can be calculated using the previous set. # Since there's guaranteed to be an answer, we will eventually make # modulus 0 possible. We then backtrack to...
# File: koodous_consts.py # # Copyright (c) 2018-2021 Splunk Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
""" Conditional expression Evaluated to one of two expressions depending on a boolean. e.g: result = true_value if condition else false_value """ def sequence_class(immutable): return tuple if immutable else list seq = sequence_class(immutable=True) t = seq("OrHasson") print(t) print(type(t))
def print_two(*args): arg1, arg2 =args print(f"arg1 : {arg1},arg2 : {arg2}") def print_two_again(arg1,arg2): print(f"arg1:{arg1},arg2:{arg2}") def print_one(arg1): print(f"arg1:{arg1}") def print_none(): print("I got nothing") print_two("Zed","Shaw") print_two_again("Zed","Shaw") print_one("First!")...
''' Provide transmission-daemon RPC credentials ''' rpc_ip = '' rpc_port = '' rpc_username = '' rpc_password = ''
''' Kattis - secretchamber Without much execution time pressure along with nodes being characters, we opt to use python with a dict of dicts as our adjacency matrix. This is basically just floyd warshall transitive closure. Time: O(V^3), Mem: O(V^2) ''' n, q = input().split() n = int(n) q = int(q) edges = [] node_nam...
class Person: def __init__(self, name, age): self.name = name self.age = age maria = Person("Maria Popova", 25) print(hasattr(maria,"name")) print(hasattr(maria,"surname")) print(getattr(maria, "age")) setattr(maria, "surname", "Popova") print(getattr(maria, "surname"))
def spiral(steps): dx = 1 dy = 0 dd = 1 x = 0 y = 0 d = 0 for _ in range(steps - 1): x += dx y += dy d += 1 if d == dd: d = 0 tmp = dx dx = -dy dy = tmp if dy == 0: dd += 1 yie...
with open('do-plecaka.txt', 'r') as f: dane = [] # getting and cleaning data for line in f: dane.append([int(x) for x in line.split()]) # printing for x in dane: print(x)
#escreva um programa que pergunte o salario de um funcionario #e calcule o valor do seu aumento. #para salarios superiores a R$1.250,00 #calcule um aumento de 10%. #para salarios inferiores ou iguais #o aumento è de 15% s=float(input("\nQual o salario que voce recebe? R$ ")) a=(15*s)/100 b=(10*s)/100 if s<=1250: ...
# Полуавтоматические тесты def test_function(list_in): ... # вход лист с числами и строкама # выход лист с числами ... list_temp = [] # i = 0 # while (type(list_in[i]) == int): for i in range(len(list_in)): if type(list_in[i])== int: list_temp.append(list_in[i]) ...
# 大号的T恤 def make_shirt(size, font='I love; Python'): print('size of shirt is ' + size) print('font of shirt is ' + font) make_shirt('L') make_shirt('M') make_shirt('S', 'hello')
# measurements in inches ball_radius = 3 goal_top = 50 goal_width = 58 goal_half = 29 angle_threshold = .1 class L_params(object): horizontal_offset = 14.5 vertical_offset = 18.5 min_y = ball_radius - vertical_offset+3 # in robot coords max_y = goal_top - vertical_offset min_x = -14.5 max_x = 14.0 l1 = 11 l...
class Solution: def numDecodings(self, s: str) -> int: if s[0] == '0' or '00' in s: return 0 for idx, _ in enumerate(s): if idx == 0: pre, cur = 1, 1 else: tmp = cur if _ != '0': if s[idx - 1] == ...
def find_skew_value(text): length_of_text = len(text) skew_value = 0 skew_value_list = [] for i in range(0, length_of_text): if text[i] == 'C': skew_value = skew_value - 1 elif text[i] == 'G': skew_value = skew_value + 1 skew_value_list.append(skew_v...
#!/usr/bin/env python # -*- coding: UTF-8 -*- def do_something(): print("This is a hello from do_something().") def test1(): # 没有 return 的函数,默认返回 None。 # None 如果放在 if 中,就是 False。 print(do_something()) # 根据闰年的定义: # 年份应该是 4 的倍数; # 年份能被 100 整除但不能被 400 整除的,不是闰年。 # 所以,相当于要在能被 4 整除的年份中,排除那些能被 100 整除...
# -*- coding: utf-8 -*- """ Created on Wed May 22 10:46:35 2019 @author: SPAD-FCS """ class correlations: pass def selectG(G, selection='average'): """ Return a selection of the autocorrelations ========== =============================================================== Input Meaning -...
#!/usr/bin/env python3 etape = 1 compteur = 0 n = 0 while True: print(f"{etape:4d} : {n:5d} { -2+(etape)*(etape+2):6d} ; ", end="") for _ in range(3 + etape): n += 1 print(n, end=" ") compteur += 1 if compteur == 500000: print(n) exit() print()...
class EPIconst: class FeatureName: pseknc = "pseknc" cksnap = "cksnap" dpcp = "dpcp" eiip = "eiip" kmer = "kmer" tpcp = "tpcp" all = sorted([pseknc, cksnap, dpcp, eiip, kmer, tpcp]) class CellName: K562 = "K562" NHEK = "NHEK" IMR90...
# Functions can encapsulate functionality you want to reuse: def even_odd(x): if x % 2 == 0: print("even") else: print("odd") # reused even_odd(2) even_odd(4) even_odd(7) even_odd(22) even_odd(8) # output should be >>> even, even, odd, even, even
# Let A[1..n] be an array of integers. For all i from 1 to n find a subarray with maximum sum that # covers the position i (more formally, for every i, find the largest value A[l] + A[l + 1] + · · · + A[r] # among all pairs of indices l and r such that 1 ≤ l ≤ i ≤ r ≤ n). # Input # The first line contains an integer n ...
# -*- coding: utf-8 -*- # __author__ = xiaobao # __date__ = 2019/12/28 15:41:18 # desc: desc # 给定一个由 '1'(陆地)和 '0'(水)组成的的二维网格,计算岛屿的数量。一个岛被水包围,并且它是通过水平方向或垂直方向上相邻的陆地连接而成的。你可以假设网格的四个边均被水包围。 # 示例 1: # 输入: # 11110 # 11010 # 11000 # 00000 # 输出: 1 # 示例 2: # 输入: # 11000 # 11000 # 00100 # 00011 # 输出: 3 # 来源:力扣(LeetCode)...
version = '0.11.0' version_cmd = 'confd -version' download_url = 'https://github.com/kelseyhightower/confd/releases/download/vVERSION/confd-VERSION-linux-amd64' install_script = """ chmod +x confd-VERSION-linux-amd64 mv -f confd-VERSION-linux-amd64 /usr/local/bin/confd """
class Sensors: def __init__(self, **kwargs): self.sensor_data_dictionary = kwargs def update(self, **kwargs): self.sensor_data_dictionary = kwargs def get_value(self, key): return (self.sensor_data_dictionary.get(key))
# https://www.google.com/webhp?sourceid=chrome- # instant&ion=1&espv=2&ie=UTF-8#q=dp%20coin%20change def coin_change_recur(coins,n,change_sum): # If sum is 0 there exists a solution with no coins if change_sum == 0: return 1 # if sum is less then 0 no solution exists if change_sum < 0: ...
def calc_fuel(mass: int): return max(mass // 3 - 2, 0) def calc_fuel_rec(mass: int): fuel = calc_fuel(mass) if fuel == 0: return fuel else: return fuel + calc_fuel_rec(fuel)
MODEL_TYPE = { "PointRend" : 1, "MobileNetV3Large" : 2, "MobileNetV3Small" : 3 } TASK_TYPE = { "Object Detection" : 1, "Instance Segmentation (Map)" : 2, "Instance Segmentation (Blend)" : 3 } """ 0 : No Ml model to run 1 : Object Detection : PointRend 2 : Instance Detection (Map) : MobileV3Lar...
class Cls: x = "a" d = {"a": "ab"} cl = Cls() cl.x = "b" d[cl.x]
#Copyright 2018 Infosys Ltd. #Use of this source code is governed by Apache 2.0 license that can be found in the LICENSE file or at #http://www.apache.org/licenses/LICENSE-2.0 . ####DATABASE QUERY STATUS CODES#### CON000 = 'CON000' # Successfull database connection CON001 = 'CON001' # Failed to connect to databa...
#a = int(input()) #b = int(input()) entrada = input() a, b = entrada.split(" ") a = int(a) b = int(b) if(a > b): if(a%b == 0): print ("Sao Multiplos") else: print("Nao sao Multiplos") else: if(b%a == 0): print("Sao Multiplos") else: print("Nao sao Multiplos")
# coding: utf-8 # === admin NUM_SUFFICIENT_TX = 10 # sufficient num. of tx to estimate pdr by ACK WAITING_FOR_TX = u'waiting_for_tx' WAITING_FOR_RX = u'waiting_for_rx' # === addressing BROADCAST_ADDRESS ...
class Solution: def orangesRotting(self, grid: List[List[int]]) -> int: d=0 while True: c=False old=[] for i in range(len(grid)): s=[] for j in range(len(grid[0])): s.append(grid[i][j]) old.append...
class Solution: def binaryGap(self, n: int) -> int: a = str(bin(n)) a = a[2:] dis = [] c = 0 for i in range(len(a)): if a[i] == "1": dis.append(c) c = 0 c +=1 return max(dis) ...
class Suggestion: def __init__(self, obj=None): """ See "https://smartystreets.com/docs/cloud/us-autocomplete-api#http-response" """ self.text = obj.get('text', None) self.street_line = obj.get('street_line', None) self.city = obj.get('city', None) self.state ...