Закинул ещё мусора с Интеллекта, наверное это последнее
This commit is contained in:
@@ -3,7 +3,7 @@ import zlib, json
|
||||
#n = int(input()) # Лучше не смотреть на это НЕ решение)
|
||||
#pool = list(map(int, input().split()))
|
||||
#ans = sum(pool)//2
|
||||
dis = {
|
||||
'''dis = {
|
||||
206: 207,
|
||||
155: 156,
|
||||
355: 360,
|
||||
@@ -13,6 +13,9 @@ dis = {
|
||||
464: 465,
|
||||
54: 103,
|
||||
311: 343
|
||||
}'''
|
||||
dis = {
|
||||
|
||||
}
|
||||
print(json.dumps(dis))
|
||||
print(json.loads(json.dumps(dis)))
|
||||
|
||||
9
uts/uts_17_aut_py/4/A.py
Normal file
9
uts/uts_17_aut_py/4/A.py
Normal file
@@ -0,0 +1,9 @@
|
||||
n, k, x = list(map(int, input().split()))
|
||||
from itertools import combinations_with_replacement
|
||||
cnt = 0
|
||||
for i in combinations_with_replacement(range(1, n+1), k):
|
||||
if cnt == x:
|
||||
for j in i:
|
||||
print(j, end=' ')
|
||||
break
|
||||
cnt += 1
|
||||
9
uts/uts_17_aut_py/4/B.py
Normal file
9
uts/uts_17_aut_py/4/B.py
Normal file
@@ -0,0 +1,9 @@
|
||||
n, k = list(map(int, input().split()))
|
||||
find = tuple(map(int, input().split()))
|
||||
from itertools import combinations_with_replacement
|
||||
cnt = 0
|
||||
for i in combinations_with_replacement(range(1, n+1), k):
|
||||
if i == find:
|
||||
print(cnt)
|
||||
break
|
||||
cnt += 1
|
||||
6
uts/uts_17_aut_py/4/C.py
Normal file
6
uts/uts_17_aut_py/4/C.py
Normal file
@@ -0,0 +1,6 @@
|
||||
le, de = list(map(int, input().split()))
|
||||
de = bin(de)[2:]
|
||||
if len(de) < le:
|
||||
de = ('0'*(le - len(de))) + de
|
||||
|
||||
print(de)
|
||||
47
uts/uts_17_aut_py/FoxNewBot/main.py
Normal file
47
uts/uts_17_aut_py/FoxNewBot/main.py
Normal file
@@ -0,0 +1,47 @@
|
||||
from telegram.ext import Updater
|
||||
updater = Updater(token='462381555:AAGpyrfrkxt0_uitj-z4ZFUMDMfQt0MdZhY')
|
||||
|
||||
dispatcher = updater.dispatcher
|
||||
import sqlite3
|
||||
database_connector = sqlite3.connect
|
||||
DATABASE = 'sq.sql'
|
||||
import logging
|
||||
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
|
||||
level=logging.INFO)
|
||||
|
||||
|
||||
def start(bot, update):
|
||||
conn = database_connector(DATABASE)
|
||||
conn.execute('INSERT INTO Users VALUES (:user_id, :us)', {"user_id": update.message.chat_id, "us": 'User'})
|
||||
conn.commit()
|
||||
conn.close()
|
||||
bot.send_message(chat_id=update.message.chat_id, text="Вы успешно подписались на новости Лисьего Носа!")
|
||||
print(update.message.chat_id)
|
||||
|
||||
DEBUG = True
|
||||
def send(bot, update):
|
||||
if update.message.chat_id != 130703270:
|
||||
return
|
||||
conn = database_connector(DATABASE)
|
||||
cursor = conn.cursor()
|
||||
cursor.execute('SELECT user_id FROM Users')
|
||||
for i in cursor.fetchall():
|
||||
if DEBUG:
|
||||
bot.send_message(chat_id=int(i[0]), text=update.message.text[5:])
|
||||
else:
|
||||
bot.send_message(chat_id=130703270, text=update.message.text[5:])
|
||||
conn.close()
|
||||
print('yes')
|
||||
|
||||
def kot(bot, update):
|
||||
bot.send_message(chat_id=update.message.chat_id, photo=open('test.png', 'rb'))
|
||||
|
||||
from telegram.ext import CommandHandler
|
||||
|
||||
start_handler = CommandHandler('start', start)
|
||||
|
||||
dispatcher.add_handler(start_handler)
|
||||
dispatcher.add_handler(CommandHandler('send', send))
|
||||
dispatcher.add_handler(CommandHandler('kot', kot))
|
||||
|
||||
updater.start_polling()
|
||||
2
uts/uts_17_aut_py/FoxNewBot/requirements.txt
Normal file
2
uts/uts_17_aut_py/FoxNewBot/requirements.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
python-telegram-bot
|
||||
|
||||
13
uts/uts_17_aut_py/lal/i-v3.py
Normal file
13
uts/uts_17_aut_py/lal/i-v3.py
Normal file
@@ -0,0 +1,13 @@
|
||||
import math
|
||||
|
||||
n = 10000000
|
||||
|
||||
a = [True] * n
|
||||
|
||||
for i in range(2, int(math.sqrt(n))):
|
||||
for j in range(i * 2, n, i):
|
||||
a[j] = False
|
||||
b = [i for i in range(2, n) if a[i]]
|
||||
|
||||
#print(b)
|
||||
print(len(b))
|
||||
Reference in New Issue
Block a user