Дамп всех задач

This commit is contained in:
2017-05-22 13:29:43 +03:00
parent b970626fef
commit 93746b05d7
173 changed files with 2505 additions and 0 deletions

8
olymp2017/1.py Normal file
View File

@@ -0,0 +1,8 @@
def SumRange(a, b):
sum = 0
for i in range(a, b):
sum += i
sum += b
return sum
a, b = list(map(int, input().split()))
print(SumRange(a, b))

12
olymp2017/2.py Normal file
View File

@@ -0,0 +1,12 @@
def Calc(a, b, op):
dived = {
1: a-b,
2: a*b,
3: a/b,
}
try:
return dived[op]
except KeyError:
return a+b
a, b, op = list(map(int, input().split()))
print(Calc(a, b, op))

6
olymp2017/3.py Normal file
View File

@@ -0,0 +1,6 @@
def IsPrime(n):
for i in range(2, n):
if (n % i == 0) and (i!=1) and (i!=n):
return False
return True
print(IsPrime(int(input())))

7
olymp2017/4.py Normal file
View File

@@ -0,0 +1,7 @@
def fun(s):
sum = 0
ff = len(s)
for i in range(ff):
sum += int(s[i])
return sum
print(fun(str(input())))

2
olymp2017/5.py Normal file
View File

@@ -0,0 +1,2 @@
from math import factorial
print(factorial(int(input())))