content
stringlengths
7
1.05M
#!/usr/bin/env python # encoding: utf-8 # # Copyright (c) 2016 Dean Jackson <deanishe@deanishe.net> # # MIT Licence. See http://opensource.org/licenses/MIT # # Created on 2016-12-17 # """CLI program sub-commands."""
n = int(input()) for i in range(1, 10): if n % i != 0: continue for j in range(1, 10): if n % j != 0: continue for k in range(1, 10): if n % k != 0: continue for m in range(1, 10): if n % m != 0: con...
''' Faça um Programa que peça a temperatura em graus Celsius, transforme e mostre em graus Fahrenheit. ''' temperatura = float(input('Digite a temperatura em graus Celsius: ')) fahrenheit = temperatura * 9 / 5 + 32 print('{:.1f} graus Celsius equivale a {:.1f} graus Fahrenheit!'.format(temperatura, fahrenheit))
def clean_path(path): """ Removes illegal characters from path (Windows only) """ return ''.join(i for i in path if i not in '<>:"/\|?*')
reserv_list = set() party_list = set() command = input() while command != 'PARTY': reserv_list.add(command) command = input() if command == 'PARTY': command = input() while command != 'END': party_list.add(command) command = input() diff = abs(len(reserv_list) - len(party_...
# Author Atticus # -*- coding =utf-8 -*- # 中文翻译# # -----------# ### 操作符 ### # -----------# info = ( (("*", "An elegant way to set up your scene"), ((), ()), ("zh_CN", "一种优雅的设置场景的方式", (False, ())), ), (("*", "3D View > Object mode > Shortcut 'F' / Side Menu > Edit"), ((), ()), (...
class Player(object): TEAM_GREEN = 0 TEAM_RED = 1 TEAM_BLUE = 2 def __init__(self, id, front_grey, front_red, front_blue, deck_grey, deck_red, deck_blue): self.id = id self.front_grey = front_grey self.front_red = front_red self.front_blue = front_blue self.deck...
# Advent of code 2021 : Day 1 | Part 2 # Source : https://adventofcode.com/2020/day/1 infile = "aoc/2020/Day 1/input.txt" inputs = list(map(int, open(infile).read().splitlines())) print([i*j*_ for i in inputs for j in inputs for _ in inputs if i + j + _ == 2020][0]) # Answer : 165080960
#!/usr/bin/python class JustCounter: __secret_count = 0 def count(self): self.__secret_count += 1 print(self.__secret_count) counter = JustCounter() counter.count() counter.count() # can't access print(counter.__secret_count)
N = int(input()) A = [int(n) for n in input().split()] ans = [0] + [0]*N for i in range(N-1): ans[A[i]] += 1 for i in range(1, N+1): print(ans[i])
# -*- encoding: utf-8 -*- """ Created by Ênio Viana at 20/06/2021 at 15:07:27 Project: py_dss_interface [jun, 2021] """
def solve_part1(numbers, boards): marked = {}.fromkeys(list(boards.keys())) for key in marked: # idx // 5 idx % 5 # row column marked[key] = ([0,0,0,0,0],[0,0,0,0,0]) for number in numbers: for board_idx in boards: ...
metros = int(input('Digite o valor em metros: ')) conv_cm = metros * 100 conv_milimetros = metros * 1000 conv_km = metros * 1000 conv_deca = metros / 10 conv_deci = metros * 10 conv_hect = metros / 100 print(f'Segue abaixo a conversão de metros para os valores solicitados (Km, Hect, Decametros, Decimetros, Centimetro...
def count(start, end=None, step=None): if step == 0: raise IndexError if hasattr(step, "__iter__"): raise TypeError if (hasattr(start, "__iter__") or hasattr(end, "__iter__")): return __iter_count(start, end, step) else: return __num_count(start, end, step) ...
#!python2.7 # -*- coding: utf-8 -*- """ Created by kun on 2016/10/10. """ __author__ = 'kun'
def prime(n): i=2 while i<=n//2: if n%i==0: return 0 i=i+1 return 1 n=2 sum=0 while n<=2000000: if prime(n): sum=sum+n n=n+1
# Given an integer n, generate a square matrix filled with elements from 1 to n^2 in spiral order. # For example, # Given n = 3, # You should return the following matrix: # [ # [ 1, 2, 3 ], # [ 8, 9, 4 ], # [ 7, 6, 5 ] # ] class Solution: # @param {integer} n # @return {integer[][]} def generateMatri...
# # This file contains the Python code from Program 4.20 of # "Data Structures and Algorithms # with Object-Oriented Design Patterns in Python" # by Bruno R. Preiss. # # Copyright (c) 2003 by Bruno R. Preiss, P.Eng. All rights reserved. # # http://www.brpreiss.com/books/opus7/programs/pgm04_20.txt # class LinkedList(o...
#file = open("data.csv", "r") #for line in file: # print(line) with open("output.csv", "a") as fileout: fileout.write("Hello World") fileout.close()
# -*- coding: utf-8 -*- __title__ = 'atomos' __version_info__ = ('0', '3', '1') __version__ = '.'.join(__version_info__) __author__ = 'Max Countryman' __license__ = 'BSD' __copyright__ = 'Copyright 2014 Max Countryman'
# Copyright (C) 2019 Intel Corporation # # SPDX-License-Identifier: MIT class Converter: def __init__(self, cmdline_args=None): pass def __call__(self, extractor, save_dir): raise NotImplementedError() def _parse_cmdline(self, cmdline): parser = self.build_cmdline_parser() ...
class Credential : """ Class that generates new instances of credentials """ credential_list = [] def __init__ (self,account_name,email,password): """ __init__ method that helps us define properties for our objects. """ """ Args: accountname : New nam...
primes = [ 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251 ] # len(primes) = 54 # symbol_size = 3 # for prime i...
# -*- coding: utf-8 -*- RADIX = 3 BYTE_RADIX = 256 MAX_TRIT_VALUE = (RADIX - 1) // 2 MIN_TRIT_VALUE = -MAX_TRIT_VALUE NUMBER_OF_TRITS_IN_A_BYTE = 5 NUMBER_OF_TRITS_IN_A_TRYTE = 3 HASH_LENGTH = 243 BYTE_TO_TRITS_MAPPINGS = [[]] * HASH_LENGTH TRYTE_TO_TRITS_MAPPINGS = [[]] * 27 HIGH_INTEGER_BITS = 0xFFFFFFFF HIGH_LON...
i=int(input("Değer giriniz:")) #Sayi kaça kadar sıralanacak. x=0 y=int(input("Atlanacak sayi")) #Hangi sayi atlansın. for x in range(i): #Döngü x i'ye gelene kadar dönsün. x+=1 # X her defasında 1 arttırılsın. if x==y: #Eğer x y'ye denk gelirse; continue #Bu sayıyı atla ve döngüye devam et. print(x)...
""" `adafruit_hid` ==================================================== This driver simulates USB HID devices. Currently keyboard and mouse are implemented. * Author(s): Scott Shawcroft, Dan Halbert """
class AttributeDict(dict): __slots__ = () __getattr__ = dict.__getitem__ __setattr__ = dict.__setitem__ def __init__(self, dictionary: dict = {}): super().__init__() self.update(dictionary) _defaults = AttributeDict({ "master": "master", "develop": "develop", "...
#encoding:utf-8 subreddit = 'HQDesi' t_channel = '@r_HqDesi' def send_post(submission, r2t): return r2t.send_simple(submission)
class OrderElement: def __init__(self, product, quantity): self.product = product self.quantity = quantity def calculate_price(self): return self.product.unit_price * self.quantity def __str__(self): return f"{self.product} x {self.quantity}"
#!/usr/bin/env python3 class Parser: def __init__(self): self.token = None self.remained_token = None '''from regex string to NFA class''' def parse(self, regex_str): if len(regex_str) == 0: print("The compiled content is empty. Stop parsing.") return None ...
def isgreaterthan20(number1,number2): print(number1) print(number2) num=20 num1=10 isgreaterthan20(num,num1)
class Solution: def findDuplicates(self, nums): """ :type nums: List[int] :rtype: List[int] """ memo={} for i,v in enumerate(nums): if memo.get(v) is None: memo[v]=1 else: memo[v]+=1 result=[] for...
# -*- coding:utf-8 -*- """ Description: Transaction Type in AntShares Usage: from AntShares.Core.TransactionType import TransactionType """ class TransactionType(object): MinerTransaction = 0x00 IssueTransaction = 0x01 ClaimTransaction = 0x02 EnrollmentTransaction = 0x20 VotingTransaction =...
class InvalidIdError(RuntimeError): def __init__(self, id_value): super(InvalidIdError, self).__init__() self.id = id_value
sku = [{"name": "id", "type": "varchar(256)"}, {"name": "object", "type": "varchar(256)"}, {"name": "active", "type": "boolean"}, {"name": "attributes", "type": "varchar(max)"}, {"name": "created", "type": "timestamp"}, {"name": "currency", ...
def import_code_query(path, project_name=None, language=None): if not path: raise Exception('An importCode query requires a project path') if project_name and language: fmt_str = u"""importCode(inputPath=\"%s\", projectName=\"%s\", language=\"%s\")""" return fmt_str % (path, project_nam...
#no refactoring class hash_test: participant = ["leo","kiki","eden"] completion = ["leo","kiki"] p = 31 m = 0xfffff x = 0 hash_table = list([0 for i in range(m)]) unfinished = list() # polynomial rolling hash function. for i in participant: print(i) mo...
# -*- coding: utf-8 - # # This file is part of tproxy released under the MIT license. # See the NOTICE for more information. version_info = (0, 5, 4) __version__ = ".".join(map(str, version_info))
"""Errors raised by mailmerge.""" class MailmergeError(Exception): """Top level exception raised by mailmerge functions."""
def eh_primo(x): if (x==3) or (x==2): return True if (x<2) or (x%2==0): return False for i in range(3, int(x**0.5)+1, 2): if x%i==0: return False return True def sup_primo(num): while num >= 10: sup = num % 10 num = int(num / 10) if no...
""" 深圳航空订单采集 createby swm 2018/06/11 """
# -*- coding: iso-8859-1 -*- """ MoinMoin - Widget base class @copyright: 2002 Juergen Hermann <jh@web.de> @license: GNU GPL, see COPYING for details. """ class Widget: def __init__(self, request, **kw): self.request = request def render(self): raise NotImplementedError
#listing #representacion de grafos a,b,c,d,e,f,g,h = range(8) N = [{b:2,c:1,d:3,e:9,f:4}, #a {c:4,e:3}, #b {d:8}, #c {e:7}, #d {f:5}, #e {c:2,g:2,h:2}, #f {f:1,h:6}...
class Config(object): _instance = None def __new__(self): if not self._instance: self._instance = super(Config, self).__new__(self) return self._instance def setConfig(self, config): self.config = config def get(self, key): return self.config[key] def ...
#nanan=input("nafn:") #arg=float(input("hæð 1 metrum:")) #print(arg) #if arg == 2: # print("þú ert 2 metra há 200cm") #elif arg >= 2: # print("þú ert",arg-2,"metrum hæri og",(arg*100)-200,"cm ifir") #elif arg <= 2: # print("þú ert",arg-2,"metrum lægri og",(arg*100)-200,"cm undir") ######################...
# Faca um programa que tenha uma funcao # chamada area(), # que receba as dimensoes de um terreno # retangular(largura e comprimento) e mostre a # area do terreno def area(larg, comp): a = larg * comp print(f'A area de um terreno {larg} x {comp} eh de {a}m2.') print(' Controle de Terrenos') print('-' * 20) ...
class Solution: def findMinFibonacciNumbers(self, k: int) -> int: fib = [] fib.extend([1, 1]) j = 1 i = 2 # calculate fibonacci number greater than k while j < k: x = fib[i - 1] + fib[i - 2] fib.append(x) i += 1 j = x ...
input() groups = sorted([ int(i) for i in input().split() ], reverse=True) cars = 0 i = 0 j = len(groups) - 1 while i <= j: g = groups[i] if g == 4: i += 1 cars += 1 continue cur_car = g while groups[j] <= 4 - cur_car and i < j: cur_car += groups[j] j -= 1 ...
def auto_newline(text: str, max_line_length: int): def wrap_line_helper(line: str): words = line.split(" ") wrapped_line = [] current_line = "" for word in words: current_line += word if len(current_line) > max_line_length: current_line = " ".j...
def explore(lines): y = 0 x = lines[0].index('|') dx = 0 dy = 1 answer = '' steps = 0 while True: x += dx y += dy if lines[y][x] == '+': if x < (len(lines[y]) - 1) and lines[y][x+1].strip() and dx != -1: dx = 1 dy = 0 ...
# Search in Rotated Sorted Array: https://leetcode.com/problems/search-in-rotated-sorted-array/ # There is an integer array nums sorted in ascending order (with distinct values). # Prior to being passed to your function, nums is rotated at an unknown pivot index k (0 <= k < nums.length) such that the resulting array i...
class Solution: def rotate(self, nums: List[int], k: int) -> None: k %= len(nums) if k > 0: for i, v in enumerate(nums[-k:] + nums[0:-k]): nums[i] = v
'''Desenvolva um programa que leia o comprimento de três retas e diga ao usuário se elas podem ou não formar um triângulo.''' #minha resolução #https://escolaeducacao.com.br/condicao-da-existencia-de-um-triangulo/ a = float(input('Digite o primeiro comprimento: ')) b = float(input('Digite o segundo comprimento: ')) c ...
# sort given sequence given that the numbers go from 1 to n def cyclic_sort(seq): for i in range(len(seq)): num = seq[i] if num != seq[num-1]: # swap seq[num-1], seq[i] = seq[i], seq[num-1] def main(): seq = [5,4,1,2,3] cyclic_sort(seq) print(f'seq = {seq}') ...
class Student: # Using a global base for all the available courses numReg = [] # We will initalise the student class def __init__(self, number, name, family, courses=None): if courses is None: courses = [] self.number = number self.numReg.append(self) ...
class Task: """ Abstract class defining a task. A task is an atomic action (i.e: switch on/off light, play music, etc ...) It can take arguments which will be defined by the user (i.e: turn off light between 9 am and 1 pm. 9 and 1 can be defined as parameters given by user). """ def __init__(se...
############################################################################### ############################################################################### #Copyright (c) 2016, Andy Schroder #See the file README.md for licensing information. ##########################################################################...
#D def fibonacci(N :int) -> int: if N == 1: return 1 elif N == 2: return 1 else: return fibonacci(N-2)+fibonacci(N-1) def main(): # input N = int(input()) # compute # output print(fibonacci(N)) if __name__ == '__main__': main()
class Solution: def countVowelStrings(self, n: int) -> int: d = ['a', 'e', 'i', 'o', 'u'] path = [] count = 0 def backtracking(n, start): nonlocal count if n == 0: count += 1 return for i in range(start, 5):...
class _EventTarget: '''https://developer.mozilla.org/en-US/docs/Web/API/EventTarget''' NotImplemented class _Node(_EventTarget): '''https://developer.mozilla.org/en-US/docs/Web/API/Node''' NotImplemented class _Element(_Node): '''ref of https://developer.mozilla.org/en-US/docs/Web/API/Element'''...
# This is function for sorting the array using bubble sort def bubble_sort(length, array): # It takes two arguments -> Length of the array and the array itself. for i in range(length): j = 0 for j in range(0, length-i-1): if array[j] > array[j+1]: array[j], array[j+1] = a...
print(type(1)) print(type('runnob')) print(type([2])) print(type({0:'zero'}))
def test(): assert ( len(TRAINING_DATA) == 3 ), "Irgendetwas scheint mit deinen Daten nicht zu stimmen. Erwartet werden 3 Beispiele." assert all( len(entry) == 2 and isinstance(entry[1], dict) for entry in TRAINING_DATA ), "Die Trainingsdaten haben nicht das richtige Format. Erwartet wir...
""" Primality testing """ _tiny_primes = [2, 3, 5, 7, 11, 13, 17, 19] _max_tiny_prime = 19 _tiny_primes_set = set(_tiny_primes) def _is_tiny_prime(n): return n <= _max_tiny_prime and n in _tiny_primes_set def _has_tiny_factor(n): for p in _tiny_primes: if n % p == 0: return True retu...
class Solution: def reverseStr(self, s, k): """ :type s: str :type k: int :rtype: str """ result = '' for i in range(0, len(s), 2*k): result += s[i:i+k][::-1] + s[i+k:i+2*k] return result
#Escreva um programa que leia a velocidade de um carro. Se ele ultrapassar 80Km/h, mostre #uma mensagem dizendo que ele foi multado. A multa vai custar R$7,00 por cada Km acima do limite velocidad = float(input("digite a velocidade que o carro esta: ")) if velocidad >80 : velocidad = velocidad-80 multa = velo...
# author: Fei Gao # # Count And Say # # The count-and-say sequence is the sequence of integers beginning as follows: # 1, 11, 21, 1211, 111221, ... # 1 is read off as "one 1" or 11. # 11 is read off as "two 1s" or 21. # 21 is read off as "one 2, then one 1" or 1211. # Given an integer n, generate the nth sequence. # No...
file = open('file.txt', 'r') f = file.readlines() readingList = [] for line in f: readingList.append(line.strip()) print(readingList) file.close()
""" Write a Python program to get a single string from two given strings, separated by a space and swap the fisrt two characters of each string sample string: 'abc', 'xyz' expected result: 'xyc abz' """ def swap_char(str1, str2): char1 = str1[0:2] char2 = str2[0:2] str1 = str1.replace(char1, char2) str2...
#right rotation of array #it avoids unnecessary no. of recursions for large no. of rotations. def right_rot(arr,s):# s is the no. of times to rotate n=len(arr) s=s%n #print(s) for a in range(s): store=arr[n-1] for i in range(n-2,-1,-1): arr[i+1]=arr[i] arr[0]=store ...
""" Continuing from following challenge and using subroutines where appropriate: 1. Create a text file with the following data: James,Jones,01/01/99 Sarah,Smith,12/12/99 Bobby,Ball,04/04/99 Harry.Hall,06/06/99 2. Create a subroutine to ask the user for the name of the file that they wish to read from 3. Use a loop to r...
#Faça um programa que solicite uma senha de acesso do usuário, o sistema deve comparar com a senha “abc123” e:Caso o usuário digite a senha correta, informar “Acesso liberado”, masCaso o usuário digite a senha incorreta, informar “Acesso negado” e perguntar novamente enquanto a senha estiver incorreta. senha_acesso="a...
n = 0 try: i = 0 while True: m = input() if m[0] == '+': n += 1 elif m[0] == '-': n -= 1 else: i += (len(m.split(':')[1]) * n) except: pass print(i)
def box(m): m = m.lower() # converting lowercase arr = [0] * len(m) # initializing array with same length as the length i = 0 for n in m: if not ('a' <= n <= 'z'): # excluding special characters continue arr[i] = ord(n) - ord('a') # subtracting ascii character values by a...
# coding=utf-8 # -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -----------------------------------------------------...
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") def grpc_rules_repository(): http_archive( name = "rules_proto_grpc", urls = ["https://github.com/rules-proto-grpc/rules_proto_grpc/archive/2.0.0.tar.gz"], sha256 = "d771584bbff98698e7cb3cb31c132ee206a972569f4dc8b65acbdd93...
''' 给定一个链表,删除链表的倒数第 n 个节点,并且返回链表的头结点。 示例: 给定一个链表: 1->2->3->4->5, 和 n = 2. 当删除了倒数第二个节点后,链表变为 1->2->3->5. 说明: 给定的 n 保证是有效的。 进阶: 你能尝试使用一趟扫描实现吗? ''' # Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def removeNthFromEnd(...
class Embed: def __init__(self, **kwargs): allowed_args = ("title", "description", "color") for key, value in kwargs.items(): if key in allowed_args: setattr(self, key, value) def set_image(self, *, url: str): self.image = {"url": url} def set_thumbnail...
a = 7 b = 3 def func1(c,d): e = c + d e += c e *= d return e f = func1(a,b) print (f)
a: str a: bool = True my_long_var_aaaaaaaaaaaaaaaaaaaaaaaaaa: MyLongTypeAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA my_long_var_aaaaaaaaaaaaaaaaaaaaaaaaaa: MyLongTypeAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA = 1
""" Exercise 1 Write a program to create a list with random data types elements. input l = [0, "hello", 3.14, [1,2,3],{'ime':'John'}] output result = [<class 'int'>, <class 'str'>, <class 'float'>, <class 'list'>, <class 'dict'>] for item in list: # do something """ l = [0, "hell...
class Edge(object): def __init__(self, u, v, w): self.__orig = u self.__dest = v self.__w = w def getOrig(self): return self.__orig def getDest(self): return self.__dest def getW(self): return self.__w
""" Subtree of Another Tree: Given two non-empty binary trees s and t, check whether tree t has exactly the same structure and node values with a subtree of s. A subtree of s is a tree consists of a node in s and all of this node's descendants. The tree s could also be considered as a subtree of itself. https://leetco...
class UltrasonicSensor: def __init__(self, megapi, slot): self._megapi = megapi self._slot = slot self._last_val = 400 def read(self): self._megapi.ultrasonicSensorRead(self._slot, self._on_forward_ultrasonic_read) def get_value(self): return self._last_val ...
def f(t): # relation between f and t return value def rxn1(C,t): return np.array([f(t)*C0/v-f(t)*C[0]/v-k*C[0], f(t)*C[0]/v-f(t)*C[1]/v-k*C[1]])
#Three Restaurant: class Restaurant(): """A simple attempt to make class restaurant. """ def __init__(self, restaurant_name, cuisine_type): """ This is to initialize name and type of restaurant""" self.restaurant_name = restaurant_name self.cuisine_type = cuisine_type def describe...
name = input("what is your name? ") age = int(input("how old are you {0}? ".format(name))) if (18 <= age < 31): print("welcome to holiday") else: print("you are not 18-30")
"""The code template to supply to the front end. This is what the user will be asked to complete and submit for grading. Do not include any imports. This is not a REPL environment so include explicit 'print' statements for any outputs you want to be displayed back to the user. Use triple single q...
a,b = map(int,input().split()) def multiply(a,b): return a*b print(multiply(a,b))
class CoordLinkedList: # a linked list object def __init__ (self,node=None,y=None,x=None,up=None,down=None,left=None,right=None): self.up = up self.down = down self.left = left self.right = right if isinstance(node,(list,set,tuple)) and len(n...
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def kthSmallest(self, root: TreeNode, k: int) -> int: data = [] def traverse(node): if node.left: ...
# List custom images def list_custom_images_subparser(subparser): list_images = subparser.add_parser( 'list-custom-images', description=('***List custom' ' saved images of' ...
""" Use zip to transpose data from a 4-by-3 matrix to a 3-by-4 matrix. There's actually a cool trick for this! Feel free to look at the solutions if you can't figure it out. """ data = ((0, 1, 2), (3, 4, 5), (6, 7, 8), (9, 10, 11)) # 0 1 2 # 3 4 5 # 6 7 8 # 9 10 11 # # Transpose : [data]^T # # 0 3 6 9 # 1 4...
# # @lc app=leetcode id=543 lang=python3 # # [543] Diameter of Binary Tree # # @lc code=start # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def diameterOfBinaryTree(self, root): ...
VISUALIZATION_CONFIG = { 'requirements': ['d3', 'datagramas', 'topojson', 'cartogram'], 'visualization_name': 'datagramas.cartogram', 'figure_id': None, 'container_type': 'svg', 'data': { 'geometry': None, 'area_dataframe': None, }, 'options': { }, 'variables': { ...
class Solution(object): def reconstructQueue(self, people): people.sort(key=lambda x: (-x[0], x[1])) output = [] for p in people: output.insert(p[1], p) return output m = int(input()) k = Solution() array_input = [] for x in range(m): array_input.append([int...
def pent_d(n=1, pents=set()): while True: p_n = n*(3*n - 1)//2 for p in pents: if p_n - p in pents and 2*p - p_n in pents: return 2*p - p_n pents.add(p_n) n += 1 print(pent_d()) # Copyright Junipyr. All rights reserved. # https://github.com/Junipyr
#author: n01 """ This files contains the avaiable number settings for the OptionManager P.S. postpend a _VALUES to avoid confiusion with variable name """ # from constants.lang import LANGS AVAIABLE_TROUPS_VALUES = [10, 20, 30, 40, 50] TURN_LIMIT_VALUES = [25, 50, 75, 100, "∞"] GAMEMODE_VALUES = [0, 1] #World dominati...
n = int(input()) for i in range(n): vet = list(map(int, input().split())) partida = vet[0] qtd = vet[1] if partida % 2 == 0: partida += 1 soma = 0 for j in range(qtd): soma += partida partida += 2 print(soma)
# Scrapy settings for Scrapy project # # For simplicity, this file contains only settings considered important or # commonly used. You can find more settings consulting the documentation: # # https://docs.scrapy.org/en/latest/topics/settings.html # https://docs.scrapy.org/en/latest/topics/downloader-middleware....