Student (left) and Nearest Neighbor (right).
t | 1 | def encrypt(text, s): | t | 1 | def encrypt(text, s): |
2 | result = "" | 2 | result = "" | ||
3 | for i in range(len(text)): | 3 | for i in range(len(text)): | ||
4 | char = text[i] | 4 | char = text[i] | ||
5 | if(char.isupper()): | 5 | if(char.isupper()): | ||
6 | result += chr((ord(char) - s - 65) % 26 + 65) | 6 | result += chr((ord(char) - s - 65) % 26 + 65) | ||
7 | elif(char.islower()): | 7 | elif(char.islower()): | ||
8 | result += chr((ord(char) - s - 97) % 26 + 97) | 8 | result += chr((ord(char) - s - 97) % 26 + 97) | ||
9 | else: | 9 | else: | ||
10 | result += char | 10 | result += char | ||
11 | return result | 11 | return result | ||
12 | if __name__ == '__main__': | 12 | if __name__ == '__main__': | ||
13 | plaintext = input() | 13 | plaintext = input() | ||
14 | shift = int(input()) | 14 | shift = int(input()) | ||
15 | print(encrypt(plaintext,shift))s = input() | 15 | print(encrypt(plaintext,shift))s = input() | ||
16 | lst = [int(x) for x in s.split(" ")] | 16 | lst = [int(x) for x in s.split(" ")] | ||
17 | t = 0 | 17 | t = 0 | ||
18 | m = None | 18 | m = None | ||
19 | len = 0 | 19 | len = 0 | ||
20 | for n in lst: | 20 | for n in lst: | ||
21 | t += n | 21 | t += n | ||
22 | if(m==None): | 22 | if(m==None): | ||
23 | m = n | 23 | m = n | ||
24 | elif(m < n): | 24 | elif(m < n): | ||
25 | m = n | 25 | m = n | ||
26 | len += 1 | 26 | len += 1 | ||
27 | print("{} {}".format((t // len), m))tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2 | 27 | print("{} {}".format((t // len), m))tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2 | ||
> | , 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | > | , 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | ||
28 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | 28 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | ||
> | S': 1, 'T': 1, | > | S': 1, 'T': 1, | ||
29 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | 29 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | ||
30 | word = input() | 30 | word = input() | ||
31 | total = 0 | 31 | total = 0 | ||
32 | for letter in word: | 32 | for letter in word: | ||
33 | if letter in tile_dict: | 33 | if letter in tile_dict: | ||
34 | total += tile_dict[letter] | 34 | total += tile_dict[letter] | ||
35 | print(total) | 35 | print(total) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
Student (left) and Nearest Neighbor (right).
t | 1 | def encrypt(text, s): | t | 1 | def encrypt(text, s): |
2 | result = "" | 2 | result = "" | ||
3 | for i in range(len(text)): | 3 | for i in range(len(text)): | ||
4 | char = text[i] | 4 | char = text[i] | ||
5 | if(char.isupper()): | 5 | if(char.isupper()): | ||
6 | result += chr((ord(char) - s - 65) % 26 + 65) | 6 | result += chr((ord(char) - s - 65) % 26 + 65) | ||
7 | elif(char.islower()): | 7 | elif(char.islower()): | ||
8 | result += chr((ord(char) - s - 97) % 26 + 97) | 8 | result += chr((ord(char) - s - 97) % 26 + 97) | ||
9 | else: | 9 | else: | ||
10 | result += char | 10 | result += char | ||
11 | return result | 11 | return result | ||
12 | if __name__ == '__main__': | 12 | if __name__ == '__main__': | ||
13 | plaintext = input() | 13 | plaintext = input() | ||
14 | shift = int(input()) | 14 | shift = int(input()) | ||
15 | print(encrypt(plaintext,shift))s = input() | 15 | print(encrypt(plaintext,shift))s = input() | ||
16 | lst = [int(x) for x in s.split(" ")] | 16 | lst = [int(x) for x in s.split(" ")] | ||
17 | t = 0 | 17 | t = 0 | ||
18 | m = None | 18 | m = None | ||
19 | len = 0 | 19 | len = 0 | ||
20 | for n in lst: | 20 | for n in lst: | ||
21 | t += n | 21 | t += n | ||
22 | if(m==None): | 22 | if(m==None): | ||
23 | m = n | 23 | m = n | ||
24 | elif(m < n): | 24 | elif(m < n): | ||
25 | m = n | 25 | m = n | ||
26 | len += 1 | 26 | len += 1 | ||
27 | print("{} {}".format((t // len), m))tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2 | 27 | print("{} {}".format((t // len), m))tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2 | ||
> | , 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | > | , 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | ||
28 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | 28 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | ||
> | S': 1, 'T': 1, | > | S': 1, 'T': 1, | ||
29 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | 29 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | ||
30 | word = input() | 30 | word = input() | ||
31 | total = 0 | 31 | total = 0 | ||
32 | for letter in word: | 32 | for letter in word: | ||
33 | if letter in tile_dict: | 33 | if letter in tile_dict: | ||
34 | total += tile_dict[letter] | 34 | total += tile_dict[letter] | ||
35 | print(total) | 35 | print(total) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
Student (left) and Nearest Neighbor (right).
f | 1 | def encrypt(phrase, shift=3): | f | 1 | def encrypt(phrase, shift=3): |
2 | phrase_enc = '' | 2 | phrase_enc = '' | ||
3 | for letter in phrase: | 3 | for letter in phrase: | ||
4 | if letter.isalnum() == True: | 4 | if letter.isalnum() == True: | ||
5 | letter = chr(ord(letter)-shift) | 5 | letter = chr(ord(letter)-shift) | ||
6 | if letter.isalnum() == False: | 6 | if letter.isalnum() == False: | ||
7 | letter = chr(ord(letter) + 26) | 7 | letter = chr(ord(letter) + 26) | ||
n | 8 | phrase_enc += letter | n | 8 | phrase_enc += letter |
9 | return phrase_enc | 9 | return phrase_enc | ||
10 | if __name__ == '__main__': | 10 | if __name__ == '__main__': | ||
11 | plaintext = input() | 11 | plaintext = input() | ||
12 | shift = int(input()) | 12 | shift = int(input()) | ||
13 | print(encrypt(plaintext,shift))numbers = input() | 13 | print(encrypt(plaintext,shift))numbers = input() | ||
n | 14 | numbers_list = numbers.split() | n | 14 | number_list = numbers.split() |
15 | total = 0 | 15 | total = 0 | ||
16 | max = 0 | 16 | max = 0 | ||
n | 17 | for num in numbers_list: | n | 17 | for num in number_list: |
18 | total += int(num) | 18 | total += int(num) | ||
19 | if int(num) >= max: | 19 | if int(num) >= max: | ||
20 | max = int(num) | 20 | max = int(num) | ||
t | 21 | average = int(total / len(numbers_list)) | t | 21 | average = int(total / len(number_list)) |
22 | print(average, max)tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1, 'F': 4, | 22 | print(average, max)tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1, 'F': 4, | ||
> | 'G': 2, 'H': 4, 'I': 1, 'J': 8, | > | 'G': 2, 'H': 4, 'I': 1, 'J': 8, | ||
23 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | 23 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | ||
> | S': 1, 'T': 1, | > | S': 1, 'T': 1, | ||
24 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | 24 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | ||
25 | word = input() | 25 | word = input() | ||
26 | points = 0 | 26 | points = 0 | ||
27 | for letter in word: | 27 | for letter in word: | ||
28 | points += tile_dict[letter] | 28 | points += tile_dict[letter] | ||
29 | print(points) | 29 | print(points) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
Student (left) and Nearest Neighbor (right).
f | 1 | def encrypt(phrase, shift=3): | f | 1 | def encrypt(phrase, shift=3): |
2 | phrase_enc = '' | 2 | phrase_enc = '' | ||
3 | for letter in phrase: | 3 | for letter in phrase: | ||
4 | if letter.isalnum() == True: | 4 | if letter.isalnum() == True: | ||
5 | letter = chr(ord(letter)-shift) | 5 | letter = chr(ord(letter)-shift) | ||
6 | if letter.isalnum() == False: | 6 | if letter.isalnum() == False: | ||
7 | letter = chr(ord(letter) + 26) | 7 | letter = chr(ord(letter) + 26) | ||
n | 8 | phrase_enc += letter | n | 8 | phrase_enc += letter |
9 | return phrase_enc | 9 | return phrase_enc | ||
10 | if __name__ == '__main__': | 10 | if __name__ == '__main__': | ||
11 | plaintext = input() | 11 | plaintext = input() | ||
12 | shift = int(input()) | 12 | shift = int(input()) | ||
13 | print(encrypt(plaintext,shift))numbers = input() | 13 | print(encrypt(plaintext,shift))numbers = input() | ||
n | 14 | number_list = numbers.split() | n | 14 | numbers_list = numbers.split() |
15 | total = 0 | 15 | total = 0 | ||
16 | max = 0 | 16 | max = 0 | ||
n | 17 | for num in number_list: | n | 17 | for num in numbers_list: |
18 | total += int(num) | 18 | total += int(num) | ||
19 | if int(num) >= max: | 19 | if int(num) >= max: | ||
20 | max = int(num) | 20 | max = int(num) | ||
t | 21 | average = int(total / len(number_list)) | t | 21 | average = int(total / len(numbers_list)) |
22 | print(average, max)tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1, 'F': 4, | 22 | print(average, max)tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1, 'F': 4, | ||
> | 'G': 2, 'H': 4, 'I': 1, 'J': 8, | > | 'G': 2, 'H': 4, 'I': 1, 'J': 8, | ||
23 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | 23 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | ||
> | S': 1, 'T': 1, | > | S': 1, 'T': 1, | ||
24 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | 24 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | ||
25 | word = input() | 25 | word = input() | ||
26 | points = 0 | 26 | points = 0 | ||
27 | for letter in word: | 27 | for letter in word: | ||
28 | points += tile_dict[letter] | 28 | points += tile_dict[letter] | ||
29 | print(points) | 29 | print(points) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
Student (left) and Nearest Neighbor (right).
f | 1 | def encrypt (plaintext, shift = 3): | f | 1 | def encrypt (plaintext, shift = 3): |
2 | cipher = "" | 2 | cipher = "" | ||
3 | for i in range(len(plaintext)): | 3 | for i in range(len(plaintext)): | ||
4 | char = plaintext[i] | 4 | char = plaintext[i] | ||
5 | if char.isalpha(): | 5 | if char.isalpha(): | ||
6 | if (char.isupper()): | 6 | if (char.isupper()): | ||
7 | cipher += chr((ord(char) - shift - 65) % 26 + 65) | 7 | cipher += chr((ord(char) - shift - 65) % 26 + 65) | ||
8 | else: | 8 | else: | ||
9 | cipher += chr((ord(char) - shift - 97) % 26 + 97) | 9 | cipher += chr((ord(char) - shift - 97) % 26 + 97) | ||
10 | else: | 10 | else: | ||
11 | cipher += char | 11 | cipher += char | ||
12 | return cipher | 12 | return cipher | ||
13 | if __name__ == '__main__': | 13 | if __name__ == '__main__': | ||
14 | plaintext = input() | 14 | plaintext = input() | ||
15 | shift = int(input()) | 15 | shift = int(input()) | ||
16 | print(encrypt(plaintext,shift))average=0 | 16 | print(encrypt(plaintext,shift))average=0 | ||
17 | max=0 | 17 | max=0 | ||
18 | sum=0 | 18 | sum=0 | ||
19 | nums = list(map(int, input().split())) | 19 | nums = list(map(int, input().split())) | ||
20 | max=nums[0] | 20 | max=nums[0] | ||
21 | for i in range (len(nums)): | 21 | for i in range (len(nums)): | ||
22 | sum=sum+nums[i] | 22 | sum=sum+nums[i] | ||
23 | if max<nums[i]: | 23 | if max<nums[i]: | ||
24 | max=nums[i] | 24 | max=nums[i] | ||
25 | average=sum/len(nums) | 25 | average=sum/len(nums) | ||
t | t | 26 | print("%d %d"%(average,max)) | ||
26 | print("%d %d"%(average,max))tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1 | 27 | tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I | ||
> | , 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | > | ': 1, 'J': 8, | ||
27 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | 28 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | ||
> | S': 1, 'T': 1, | > | S': 1, 'T': 1, | ||
28 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | 29 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | ||
29 | word = input() | 30 | word = input() | ||
30 | total = 0 | 31 | total = 0 | ||
31 | for letter in word: | 32 | for letter in word: | ||
32 | total = total + tile_dict[letter] | 33 | total = total + tile_dict[letter] | ||
33 | print(total) | 34 | print(total) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
Student (left) and Nearest Neighbor (right).
f | 1 | def encrypt (plaintext, shift = 3): | f | 1 | def encrypt (plaintext, shift = 3): |
2 | cipher = "" | 2 | cipher = "" | ||
3 | for i in range(len(plaintext)): | 3 | for i in range(len(plaintext)): | ||
4 | char = plaintext[i] | 4 | char = plaintext[i] | ||
5 | if char.isalpha(): | 5 | if char.isalpha(): | ||
6 | if (char.isupper()): | 6 | if (char.isupper()): | ||
7 | cipher += chr((ord(char) - shift - 65) % 26 + 65) | 7 | cipher += chr((ord(char) - shift - 65) % 26 + 65) | ||
8 | else: | 8 | else: | ||
9 | cipher += chr((ord(char) - shift - 97) % 26 + 97) | 9 | cipher += chr((ord(char) - shift - 97) % 26 + 97) | ||
10 | else: | 10 | else: | ||
11 | cipher += char | 11 | cipher += char | ||
12 | return cipher | 12 | return cipher | ||
13 | if __name__ == '__main__': | 13 | if __name__ == '__main__': | ||
14 | plaintext = input() | 14 | plaintext = input() | ||
15 | shift = int(input()) | 15 | shift = int(input()) | ||
16 | print(encrypt(plaintext,shift))average=0 | 16 | print(encrypt(plaintext,shift))average=0 | ||
17 | max=0 | 17 | max=0 | ||
18 | sum=0 | 18 | sum=0 | ||
19 | nums = list(map(int, input().split())) | 19 | nums = list(map(int, input().split())) | ||
20 | max=nums[0] | 20 | max=nums[0] | ||
21 | for i in range (len(nums)): | 21 | for i in range (len(nums)): | ||
22 | sum=sum+nums[i] | 22 | sum=sum+nums[i] | ||
23 | if max<nums[i]: | 23 | if max<nums[i]: | ||
24 | max=nums[i] | 24 | max=nums[i] | ||
25 | average=sum/len(nums) | 25 | average=sum/len(nums) | ||
t | 26 | print("%d %d"%(average,max)) | t | ||
27 | tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I | 26 | print("%d %d"%(average,max))tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1 | ||
> | ': 1, 'J': 8, | > | , 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | ||
28 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | 27 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | ||
> | S': 1, 'T': 1, | > | S': 1, 'T': 1, | ||
29 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | 28 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | ||
30 | word = input() | 29 | word = input() | ||
31 | total = 0 | 30 | total = 0 | ||
32 | for letter in word: | 31 | for letter in word: | ||
33 | total = total + tile_dict[letter] | 32 | total = total + tile_dict[letter] | ||
34 | print(total) | 33 | print(total) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
Student (left) and Nearest Neighbor (right).
f | 1 | def encrypt (plaintext, shift = 3): | f | 1 | def encrypt (plaintext, shift = 3): |
2 | cipher = "" | 2 | cipher = "" | ||
3 | for i in range(len(plaintext)): | 3 | for i in range(len(plaintext)): | ||
4 | char = plaintext[i] | 4 | char = plaintext[i] | ||
5 | if char.isalpha(): | 5 | if char.isalpha(): | ||
6 | if (char.isupper()): | 6 | if (char.isupper()): | ||
7 | cipher += chr((ord(char) - shift - 65) % 26 + 65) | 7 | cipher += chr((ord(char) - shift - 65) % 26 + 65) | ||
8 | else: | 8 | else: | ||
9 | cipher += chr((ord(char) - shift - 97) % 26 + 97) | 9 | cipher += chr((ord(char) - shift - 97) % 26 + 97) | ||
10 | else: | 10 | else: | ||
11 | cipher += char | 11 | cipher += char | ||
12 | return cipher | 12 | return cipher | ||
13 | if __name__ == '__main__': | 13 | if __name__ == '__main__': | ||
14 | plaintext = input() | 14 | plaintext = input() | ||
15 | shift = int(input()) | 15 | shift = int(input()) | ||
16 | print(encrypt(plaintext,shift))average=0 | 16 | print(encrypt(plaintext,shift))average=0 | ||
17 | max=0 | 17 | max=0 | ||
18 | sum=0 | 18 | sum=0 | ||
19 | nums = list(map(int, input().split())) | 19 | nums = list(map(int, input().split())) | ||
20 | max=nums[0] | 20 | max=nums[0] | ||
21 | for i in range (len(nums)): | 21 | for i in range (len(nums)): | ||
22 | sum=sum+nums[i] | 22 | sum=sum+nums[i] | ||
23 | if max<nums[i]: | 23 | if max<nums[i]: | ||
24 | max=nums[i] | 24 | max=nums[i] | ||
25 | average=sum/len(nums) | 25 | average=sum/len(nums) | ||
n | n | 26 | print("%d %d"%(average,max)) | ||
26 | print("%d %d"%(average,max))tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1 | 27 | tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I | ||
> | , 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | > | ': 1, 'J': 8, | ||
27 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | 28 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | ||
> | S': 1, 'T': 1, | > | S': 1, 'T': 1, | ||
28 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | 29 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | ||
n | 29 | user_word = input() | n | 30 | word = input() |
30 | total = 0 | 31 | total = 0 | ||
t | 31 | for letter in user_word: | t | 32 | for letter in word: |
32 | total = total + tile_dict[letter] | 33 | total = total + tile_dict[letter] | ||
33 | print(total) | 34 | print(total) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
Student (left) and Nearest Neighbor (right).
f | 1 | def encrypt(text, s): | f | 1 | def encrypt(text, s): |
2 | result = '' | 2 | result = '' | ||
3 | for i in range(len(text)): | 3 | for i in range(len(text)): | ||
4 | char = text[i] | 4 | char = text[i] | ||
5 | if (char.isupper()): | 5 | if (char.isupper()): | ||
n | 6 | result += chr((ord(char) - s- 65) % 26 + 65) | n | 6 | result += chr((ord(char) - s - 65) % 26 + 65) |
7 | elif(char.islower()): | 7 | elif(char.islower()): | ||
n | 8 | result += chr((ord(char) - s- 97) % 26 + 97) | n | 8 | result += chr((ord(char) - s - 97) % 26 + 97) |
9 | else: | 9 | else: | ||
n | 10 | result +=char | n | 10 | result += char |
11 | return result | 11 | return result | ||
12 | if __name__ == '__main__': | 12 | if __name__ == '__main__': | ||
13 | plaintext = input() | 13 | plaintext = input() | ||
14 | shift = int(input()) | 14 | shift = int(input()) | ||
n | 15 | print(encrypt(plaintext,shift))s = input() | n | 15 | print(encrypt(plaintext,shift))stat = input() |
16 | lst = [int(x) for x in s.split(' ')] | 16 | lit = [int(x) for x in stat.split(' ')] | ||
17 | t = 0 | 17 | t = 0 | ||
18 | m = None | 18 | m = None | ||
19 | len = 0 | 19 | len = 0 | ||
n | 20 | for n in lst: | n | 20 | for n in lit: |
21 | t+=n | 21 | t += n | ||
22 | if(m==None): | 22 | if(m == None): | ||
23 | m=n | 23 | m = n | ||
24 | elif(m<n): | 24 | elif(m<n): | ||
25 | m=n | 25 | m=n | ||
26 | len += 1 | 26 | len += 1 | ||
27 | print('{} {}'.format((t//len),m))tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, ' | 27 | print('{} {}'.format((t//len),m))tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, ' | ||
> | E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | > | E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | ||
28 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | 28 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | ||
> | S': 1, 'T': 1, | > | S': 1, 'T': 1, | ||
29 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | 29 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | ||
n | 30 | word = input() | n | 30 | words = input() |
31 | points = 0 | 31 | points = 0 | ||
t | 32 | for char in word.upper(): | t | 32 | for char in words.upper(): |
33 | points += tile_dict[char] | 33 | points += tile_dict[char] | ||
34 | print(points) | 34 | print(points) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
Student (left) and Nearest Neighbor (right).
f | 1 | def encrypt(text, s): | f | 1 | def encrypt(text, s): |
2 | result = '' | 2 | result = '' | ||
3 | for i in range(len(text)): | 3 | for i in range(len(text)): | ||
4 | char = text[i] | 4 | char = text[i] | ||
5 | if (char.isupper()): | 5 | if (char.isupper()): | ||
n | 6 | result += chr((ord(char) - s - 65) % 26 + 65) | n | 6 | result += chr((ord(char) - s- 65) % 26 + 65) |
7 | elif(char.islower()): | 7 | elif(char.islower()): | ||
n | 8 | result += chr((ord(char) - s - 97) % 26 + 97) | n | 8 | result += chr((ord(char) - s- 97) % 26 + 97) |
9 | else: | 9 | else: | ||
n | 10 | result += char | n | 10 | result +=char |
11 | return result | 11 | return result | ||
12 | if __name__ == '__main__': | 12 | if __name__ == '__main__': | ||
13 | plaintext = input() | 13 | plaintext = input() | ||
14 | shift = int(input()) | 14 | shift = int(input()) | ||
n | 15 | print(encrypt(plaintext,shift))stat = input() | n | 15 | print(encrypt(plaintext,shift))s = input() |
16 | lit = [int(x) for x in stat.split(' ')] | 16 | lst = [int(x) for x in s.split(' ')] | ||
17 | t = 0 | 17 | t = 0 | ||
18 | m = None | 18 | m = None | ||
19 | len = 0 | 19 | len = 0 | ||
n | 20 | for n in lit: | n | 20 | for n in lst: |
21 | t += n | 21 | t+=n | ||
22 | if(m == None): | 22 | if(m==None): | ||
23 | m = n | 23 | m=n | ||
24 | elif(m<n): | 24 | elif(m<n): | ||
25 | m=n | 25 | m=n | ||
26 | len += 1 | 26 | len += 1 | ||
27 | print('{} {}'.format((t//len),m))tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, ' | 27 | print('{} {}'.format((t//len),m))tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, ' | ||
> | E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | > | E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | ||
28 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | 28 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | ||
> | S': 1, 'T': 1, | > | S': 1, 'T': 1, | ||
29 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | 29 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | ||
n | 30 | words = input() | n | 30 | word = input() |
31 | points = 0 | 31 | points = 0 | ||
t | 32 | for char in words.upper(): | t | 32 | for char in word.upper(): |
33 | points += tile_dict[char] | 33 | points += tile_dict[char] | ||
34 | print(points) | 34 | print(points) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
Student (left) and Nearest Neighbor (right).
f | 1 | def encrypt(plaintext, shift): | f | 1 | def encrypt(plaintext, shift): |
2 | cipher = "" | 2 | cipher = "" | ||
3 | for i in range(len(plaintext)): | 3 | for i in range(len(plaintext)): | ||
4 | char = plaintext[i] | 4 | char = plaintext[i] | ||
5 | if char.isalpha(): | 5 | if char.isalpha(): | ||
6 | if (char.isupper()): | 6 | if (char.isupper()): | ||
7 | cipher += chr((ord(char) - shift - 65) % 26 + 65) | 7 | cipher += chr((ord(char) - shift - 65) % 26 + 65) | ||
8 | else: | 8 | else: | ||
9 | cipher += chr((ord(char) - shift - 97) % 26 + 97) | 9 | cipher += chr((ord(char) - shift - 97) % 26 + 97) | ||
10 | else: | 10 | else: | ||
11 | cipher += char | 11 | cipher += char | ||
12 | return cipher | 12 | return cipher | ||
13 | if __name__ == '__main__': | 13 | if __name__ == '__main__': | ||
14 | plaintext = input() | 14 | plaintext = input() | ||
15 | shift = int(input()) | 15 | shift = int(input()) | ||
16 | print(encrypt(plaintext,shift))average=0 | 16 | print(encrypt(plaintext,shift))average=0 | ||
17 | max=0 | 17 | max=0 | ||
18 | sum=0 | 18 | sum=0 | ||
19 | nums = list(map(int, input().split())) | 19 | nums = list(map(int, input().split())) | ||
20 | max=nums[0] | 20 | max=nums[0] | ||
21 | for i in range(len(nums)): | 21 | for i in range(len(nums)): | ||
22 | sum=sum+nums[i] | 22 | sum=sum+nums[i] | ||
23 | if max<nums[i]: | 23 | if max<nums[i]: | ||
24 | max=nums[i] | 24 | max=nums[i] | ||
25 | average=sum/len(nums) | 25 | average=sum/len(nums) | ||
26 | print("%d %d"%(average,max))tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1 | 26 | print("%d %d"%(average,max))tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1 | ||
> | , 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | > | , 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | ||
27 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | 27 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | ||
> | S': 1, 'T': 1, | > | S': 1, 'T': 1, | ||
28 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | 28 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | ||
29 | sum_val=0 | 29 | sum_val=0 | ||
t | 30 | tile=input() | t | 30 | tile=input() |
31 | for i in tile: | 31 | for i in tile: | ||
32 | sum_val=sum_val+tile_dict[i] | 32 | sum_val=sum_val+tile_dict[i] | ||
33 | print(sum_val) | 33 | print(sum_val) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
Student (left) and Nearest Neighbor (right).
f | 1 | def encrypt(plaintext, shift): | f | 1 | def encrypt(plaintext, shift): |
2 | cipher = "" | 2 | cipher = "" | ||
3 | for i in range(len(plaintext)): | 3 | for i in range(len(plaintext)): | ||
4 | char = plaintext[i] | 4 | char = plaintext[i] | ||
5 | if char.isalpha(): | 5 | if char.isalpha(): | ||
6 | if (char.isupper()): | 6 | if (char.isupper()): | ||
7 | cipher += chr((ord(char) - shift - 65) % 26 + 65) | 7 | cipher += chr((ord(char) - shift - 65) % 26 + 65) | ||
8 | else: | 8 | else: | ||
9 | cipher += chr((ord(char) - shift - 97) % 26 + 97) | 9 | cipher += chr((ord(char) - shift - 97) % 26 + 97) | ||
10 | else: | 10 | else: | ||
11 | cipher += char | 11 | cipher += char | ||
12 | return cipher | 12 | return cipher | ||
13 | if __name__ == '__main__': | 13 | if __name__ == '__main__': | ||
14 | plaintext = input() | 14 | plaintext = input() | ||
15 | shift = int(input()) | 15 | shift = int(input()) | ||
16 | print(encrypt(plaintext,shift))average=0 | 16 | print(encrypt(plaintext,shift))average=0 | ||
17 | max=0 | 17 | max=0 | ||
18 | sum=0 | 18 | sum=0 | ||
19 | nums = list(map(int, input().split())) | 19 | nums = list(map(int, input().split())) | ||
20 | max=nums[0] | 20 | max=nums[0] | ||
21 | for i in range(len(nums)): | 21 | for i in range(len(nums)): | ||
22 | sum=sum+nums[i] | 22 | sum=sum+nums[i] | ||
23 | if max<nums[i]: | 23 | if max<nums[i]: | ||
24 | max=nums[i] | 24 | max=nums[i] | ||
25 | average=sum/len(nums) | 25 | average=sum/len(nums) | ||
26 | print("%d %d"%(average,max))tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1 | 26 | print("%d %d"%(average,max))tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1 | ||
> | , 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | > | , 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | ||
27 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | 27 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | ||
> | S': 1, 'T': 1, | > | S': 1, 'T': 1, | ||
28 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | 28 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | ||
29 | sum_val=0 | 29 | sum_val=0 | ||
t | 30 | tile=input() | t | 30 | tile=input() |
31 | for i in tile: | 31 | for i in tile: | ||
32 | sum_val=sum_val+tile_dict[i] | 32 | sum_val=sum_val+tile_dict[i] | ||
33 | print(sum_val) | 33 | print(sum_val) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
Student (left) and Nearest Neighbor (right).
f | 1 | def encrypt(text,s): | f | 1 | def encrypt(text,s): |
2 | result='' | 2 | result='' | ||
3 | for i in range(len(text)): | 3 | for i in range(len(text)): | ||
4 | char = text[i] | 4 | char = text[i] | ||
5 | if(char.isupper()): | 5 | if(char.isupper()): | ||
6 | result += chr((ord(char) - s - 65) % 26 + 65) | 6 | result += chr((ord(char) - s - 65) % 26 + 65) | ||
7 | elif(char.islower()): | 7 | elif(char.islower()): | ||
8 | result += chr((ord(char) - s - 97) % 26 + 97) | 8 | result += chr((ord(char) - s - 97) % 26 + 97) | ||
9 | else: | 9 | else: | ||
10 | result +=char | 10 | result +=char | ||
11 | return result | 11 | return result | ||
12 | if __name__ == '__main__': | 12 | if __name__ == '__main__': | ||
13 | plaintext = input() | 13 | plaintext = input() | ||
14 | shift = 3 | 14 | shift = 3 | ||
15 | print(encrypt(plaintext,shift))s = input() | 15 | print(encrypt(plaintext,shift))s = input() | ||
16 | lst = [int(x) for x in s.split(" ")] | 16 | lst = [int(x) for x in s.split(" ")] | ||
17 | t = 0 | 17 | t = 0 | ||
18 | m = None | 18 | m = None | ||
19 | len = 0 | 19 | len = 0 | ||
20 | for n in lst: | 20 | for n in lst: | ||
21 | t += n | 21 | t += n | ||
22 | if(m==None): | 22 | if(m==None): | ||
23 | m = n | 23 | m = n | ||
24 | elif(m < n): | 24 | elif(m < n): | ||
25 | m = n | 25 | m = n | ||
26 | len += 1 | 26 | len += 1 | ||
n | 27 | print("{} {}".format((t // len), m)) | n | ||
28 | tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I | 27 | print("{} {}".format((t // len), m))tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2 | ||
> | ': 1, 'J': 8, | > | , 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | ||
29 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | 28 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | ||
> | S': 1, 'T': 1, | > | S': 1, 'T': 1, | ||
t | 30 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | t | ||
31 | tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I | ||||
> | ': 1, 'J': 8, | ||||
32 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | ||||
> | S': 1, 'T': 1, | ||||
33 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | 29 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | ||
34 | word = input() | 30 | word = input() | ||
35 | total = 0 | 31 | total = 0 | ||
36 | for letter in word: | 32 | for letter in word: | ||
37 | if letter in tile_dict: | 33 | if letter in tile_dict: | ||
38 | total += tile_dict[letter] | 34 | total += tile_dict[letter] | ||
39 | print(total) | 35 | print(total) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
Student (left) and Nearest Neighbor (right).
f | 1 | def encrypt(text,s): | f | 1 | def encrypt(text,s): |
2 | result='' | 2 | result='' | ||
3 | for i in range(len(text)): | 3 | for i in range(len(text)): | ||
4 | char = text[i] | 4 | char = text[i] | ||
5 | if(char.isupper()): | 5 | if(char.isupper()): | ||
6 | result += chr((ord(char) - s - 65) % 26 + 65) | 6 | result += chr((ord(char) - s - 65) % 26 + 65) | ||
7 | elif(char.islower()): | 7 | elif(char.islower()): | ||
8 | result += chr((ord(char) - s - 97) % 26 + 97) | 8 | result += chr((ord(char) - s - 97) % 26 + 97) | ||
9 | else: | 9 | else: | ||
10 | result +=char | 10 | result +=char | ||
11 | return result | 11 | return result | ||
12 | if __name__ == '__main__': | 12 | if __name__ == '__main__': | ||
13 | plaintext = input() | 13 | plaintext = input() | ||
14 | shift = 3 | 14 | shift = 3 | ||
15 | print(encrypt(plaintext,shift))s = input() | 15 | print(encrypt(plaintext,shift))s = input() | ||
16 | lst = [int(x) for x in s.split(" ")] | 16 | lst = [int(x) for x in s.split(" ")] | ||
17 | t = 0 | 17 | t = 0 | ||
18 | m = None | 18 | m = None | ||
19 | len = 0 | 19 | len = 0 | ||
20 | for n in lst: | 20 | for n in lst: | ||
21 | t += n | 21 | t += n | ||
22 | if(m==None): | 22 | if(m==None): | ||
23 | m = n | 23 | m = n | ||
24 | elif(m < n): | 24 | elif(m < n): | ||
25 | m = n | 25 | m = n | ||
26 | len += 1 | 26 | len += 1 | ||
n | n | 27 | print("{} {}".format((t // len), m)) | ||
27 | print("{} {}".format((t // len), m))tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2 | 28 | tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I | ||
> | , 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | > | ': 1, 'J': 8, | ||
28 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | 29 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | ||
> | S': 1, 'T': 1, | > | S': 1, 'T': 1, | ||
t | t | 30 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | ||
31 | tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I | ||||
> | ': 1, 'J': 8, | ||||
32 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | ||||
> | S': 1, 'T': 1, | ||||
29 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | 33 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | ||
30 | word = input() | 34 | word = input() | ||
31 | total = 0 | 35 | total = 0 | ||
32 | for letter in word: | 36 | for letter in word: | ||
33 | if letter in tile_dict: | 37 | if letter in tile_dict: | ||
34 | total += tile_dict[letter] | 38 | total += tile_dict[letter] | ||
35 | print(total) | 39 | print(total) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
Student (left) and Nearest Neighbor (right).
n | 1 | def encrypt(plaintext, shift = 3): | n | 1 | def encrypt(plaintext, shift): |
2 | cipher = "" | 2 | cipher = "" | ||
n | 3 | x = shift | n | ||
4 | for i in range(len(plaintext)): | 3 | for i in range(len(plaintext)): | ||
5 | char = plaintext[i] | 4 | char = plaintext[i] | ||
6 | if char.isalpha(): | 5 | if char.isalpha(): | ||
7 | if (char.isupper()): | 6 | if (char.isupper()): | ||
n | 8 | cipher += chr((ord(char) - x - 65) % 26 + 65) | n | 7 | cipher += chr((ord(char) - shift - 65) % 26 + 65) |
9 | else: | 8 | else: | ||
n | 10 | cipher += chr((ord(char) - x - 97) % 26 + 97) | n | 9 | cipher += chr((ord(char) - shift - 97) % 26 + 97) |
11 | else: | 10 | else: | ||
12 | cipher += char | 11 | cipher += char | ||
13 | return cipher | 12 | return cipher | ||
14 | if __name__ == '__main__': | 13 | if __name__ == '__main__': | ||
15 | plaintext = input() | 14 | plaintext = input() | ||
16 | shift = int(input()) | 15 | shift = int(input()) | ||
17 | print(encrypt(plaintext,shift))average=0 | 16 | print(encrypt(plaintext,shift))average=0 | ||
18 | max=0 | 17 | max=0 | ||
19 | sum=0 | 18 | sum=0 | ||
20 | nums = list(map(int, input().split())) | 19 | nums = list(map(int, input().split())) | ||
21 | max=nums[0] | 20 | max=nums[0] | ||
22 | for i in range(len(nums)): | 21 | for i in range(len(nums)): | ||
23 | sum=sum+nums[i] | 22 | sum=sum+nums[i] | ||
24 | if max<nums[i]: | 23 | if max<nums[i]: | ||
25 | max=nums[i] | 24 | max=nums[i] | ||
26 | average=sum/len(nums) | 25 | average=sum/len(nums) | ||
27 | print("%d %d"%(average,max))tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1 | 26 | print("%d %d"%(average,max))tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1 | ||
> | , 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | > | , 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | ||
28 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | 27 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | ||
> | S': 1, 'T': 1, | > | S': 1, 'T': 1, | ||
29 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | 28 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | ||
t | 30 | sum_val=0 | t | 29 | sum_val=0 |
31 | tile=input() | 30 | tile=input() | ||
32 | for i in tile: | 31 | for i in tile: | ||
33 | sum_val=sum_val+tile_dict[i] | 32 | sum_val=sum_val+tile_dict[i] | ||
34 | print(sum_val) | 33 | print(sum_val) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
Student (left) and Nearest Neighbor (right).
n | 1 | def encrypt(text, s): | n | 1 | def encrypt(text,s): |
2 | result='' | 2 | result='' | ||
3 | for i in range(len(text)): | 3 | for i in range(len(text)): | ||
4 | char = text[i] | 4 | char = text[i] | ||
5 | if(char.isupper()): | 5 | if(char.isupper()): | ||
n | 6 | result += chr((ord(char) - s - 65) % 26 + 25) | n | 6 | result += chr((ord(char) - s - 65) % 26 + 65) |
7 | elif(char.islower()): | 7 | elif(char.islower()): | ||
8 | result += chr((ord(char) - s - 97) % 26 + 97) | 8 | result += chr((ord(char) - s - 97) % 26 + 97) | ||
9 | else: | 9 | else: | ||
n | 10 | result += char | n | 10 | result +=char |
11 | return result | 11 | return result | ||
12 | if __name__ == '__main__': | 12 | if __name__ == '__main__': | ||
13 | plaintext = input() | 13 | plaintext = input() | ||
n | 14 | shift = int(input()) | n | 14 | shift = 3 |
15 | print(encrypt(plaintext,shift))s = input() | 15 | print(encrypt(plaintext,shift))s = input() | ||
16 | lst = [int(x) for x in s.split(" ")] | 16 | lst = [int(x) for x in s.split(" ")] | ||
n | 17 | t = 0 | n | 17 | t = 0 |
18 | m = None | 18 | m = None | ||
19 | len = 0 | 19 | len = 0 | ||
20 | for n in lst: | 20 | for n in lst: | ||
21 | t += n | 21 | t += n | ||
22 | if(m==None): | 22 | if(m==None): | ||
23 | m = n | 23 | m = n | ||
24 | elif(m < n): | 24 | elif(m < n): | ||
25 | m = n | 25 | m = n | ||
26 | len += 1 | 26 | len += 1 | ||
27 | print("{} {}".format((t // len), m))tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2 | 27 | print("{} {}".format((t // len), m))tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2 | ||
> | , 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | > | , 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | ||
28 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | 28 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | ||
> | S': 1, 'T': 1, | > | S': 1, 'T': 1, | ||
29 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | 29 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | ||
t | 30 | word=input() | t | 30 | word = input() |
31 | total = 0 | 31 | total = 0 | ||
32 | for letter in word: | 32 | for letter in word: | ||
33 | if letter in tile_dict: | 33 | if letter in tile_dict: | ||
34 | total += tile_dict[letter] | 34 | total += tile_dict[letter] | ||
35 | print(total) | 35 | print(total) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
Student (left) and Nearest Neighbor (right).
f | 1 | def encrypt(text,s): | f | 1 | def encrypt(text,s): |
2 | result='' | 2 | result='' | ||
3 | for i in range(len(text)): | 3 | for i in range(len(text)): | ||
4 | char = text[i] | 4 | char = text[i] | ||
5 | if(char.isupper()): | 5 | if(char.isupper()): | ||
6 | result += chr((ord(char) - s - 65) % 26 + 65) | 6 | result += chr((ord(char) - s - 65) % 26 + 65) | ||
7 | elif(char.islower()): | 7 | elif(char.islower()): | ||
8 | result += chr((ord(char) - s - 97) % 26 + 97) | 8 | result += chr((ord(char) - s - 97) % 26 + 97) | ||
9 | else: | 9 | else: | ||
10 | result +=char | 10 | result +=char | ||
11 | return result | 11 | return result | ||
12 | if __name__ == '__main__': | 12 | if __name__ == '__main__': | ||
13 | plaintext = input() | 13 | plaintext = input() | ||
n | 14 | shift = int(input()) | n | 14 | shift = 3 |
15 | print(encrypt(plaintext,shift))s = input() | 15 | print(encrypt(plaintext,shift))s = input() | ||
16 | lst = [int(x) for x in s.split(" ")] | 16 | lst = [int(x) for x in s.split(" ")] | ||
17 | t = 0 | 17 | t = 0 | ||
18 | m = None | 18 | m = None | ||
19 | len = 0 | 19 | len = 0 | ||
20 | for n in lst: | 20 | for n in lst: | ||
21 | t += n | 21 | t += n | ||
22 | if(m==None): | 22 | if(m==None): | ||
23 | m = n | 23 | m = n | ||
24 | elif(m < n): | 24 | elif(m < n): | ||
25 | m = n | 25 | m = n | ||
26 | len += 1 | 26 | len += 1 | ||
t | 27 | print("{} {}".format((t // len), m))tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2 | t | 27 | print("{} {}".format((t // len), m))tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2 |
> | , 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | > | , 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | ||
28 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | 28 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | ||
> | S': 1, 'T': 1, | > | S': 1, 'T': 1, | ||
29 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | 29 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | ||
30 | word = input() | 30 | word = input() | ||
31 | total = 0 | 31 | total = 0 | ||
32 | for letter in word: | 32 | for letter in word: | ||
33 | if letter in tile_dict: | 33 | if letter in tile_dict: | ||
34 | total += tile_dict[letter] | 34 | total += tile_dict[letter] | ||
35 | print(total) | 35 | print(total) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
Student (left) and Nearest Neighbor (right).
n | 1 | def encrypt(text, s=3): | n | 1 | def encrypt(text, s): |
2 | result = "" | 2 | result = "" | ||
3 | for i in range(len(text)): | 3 | for i in range(len(text)): | ||
4 | char = text[i] | 4 | char = text[i] | ||
n | 5 | if (char.isupper()): | n | 5 | if(char.isupper()): |
6 | result += chr((ord(char) - s - 65) % 26 + 65 ) | 6 | result += chr((ord(char) - s - 65) % 26 + 65) | ||
7 | elif(char.islower()): | 7 | elif(char.islower()): | ||
n | 8 | result += chr((ord(char) - s - 97) % 26 + 97 ) | n | 8 | result += chr((ord(char) - s - 97) % 26 + 97) |
9 | else : | 9 | else: | ||
10 | result += char | 10 | result += char | ||
11 | return result | 11 | return result | ||
12 | if __name__ == '__main__': | 12 | if __name__ == '__main__': | ||
13 | plaintext = input() | 13 | plaintext = input() | ||
14 | shift = int(input()) | 14 | shift = int(input()) | ||
15 | print(encrypt(plaintext,shift))s = input() | 15 | print(encrypt(plaintext,shift))s = input() | ||
16 | lst = [int(x) for x in s.split(" ")] | 16 | lst = [int(x) for x in s.split(" ")] | ||
17 | t = 0 | 17 | t = 0 | ||
18 | m = None | 18 | m = None | ||
19 | len = 0 | 19 | len = 0 | ||
20 | for n in lst: | 20 | for n in lst: | ||
21 | t += n | 21 | t += n | ||
n | 22 | if(m ==None): | n | 22 | if(m==None): |
23 | m = n | 23 | m = n | ||
t | 24 | elif (m < n): | t | 24 | elif(m < n): |
25 | m= n | 25 | m = n | ||
26 | len += 1 | 26 | len += 1 | ||
27 | print("{} {}".format((t // len), m))tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2 | 27 | print("{} {}".format((t // len), m))tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2 | ||
> | , 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | > | , 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | ||
28 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | 28 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | ||
> | S': 1, 'T': 1, | > | S': 1, 'T': 1, | ||
29 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | 29 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | ||
30 | word = input() | 30 | word = input() | ||
31 | total = 0 | 31 | total = 0 | ||
32 | for letter in word: | 32 | for letter in word: | ||
33 | if letter in tile_dict: | 33 | if letter in tile_dict: | ||
34 | total += tile_dict[letter] | 34 | total += tile_dict[letter] | ||
35 | print(total) | 35 | print(total) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
Student (left) and Nearest Neighbor (right).
f | 1 | def encrypt(message, shift=3) : | f | 1 | def encrypt(message, shift=3) : |
2 | alphabet_U = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M | 2 | alphabet_U = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M | ||
> | ', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'] | > | ', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'] | ||
3 | cipher_U = [] | 3 | cipher_U = [] | ||
4 | alphabet_L = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm | 4 | alphabet_L = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm | ||
> | ', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] | > | ', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] | ||
5 | cipher_L = [] | 5 | cipher_L = [] | ||
6 | for i in range(0, len(alphabet_U)) : | 6 | for i in range(0, len(alphabet_U)) : | ||
7 | if i + shift >= 26 : | 7 | if i + shift >= 26 : | ||
8 | cipher_U.insert(0, alphabet_U[25 + (26 - i) - shift]) | 8 | cipher_U.insert(0, alphabet_U[25 + (26 - i) - shift]) | ||
9 | cipher_L.insert(0, alphabet_L[25 + (26 - i) - shift]) | 9 | cipher_L.insert(0, alphabet_L[25 + (26 - i) - shift]) | ||
10 | else : | 10 | else : | ||
11 | cipher_U.insert(0, alphabet_U[-(i + 1) - shift]) | 11 | cipher_U.insert(0, alphabet_U[-(i + 1) - shift]) | ||
12 | cipher_L.insert(0, alphabet_L[-(i + 1) - shift]) | 12 | cipher_L.insert(0, alphabet_L[-(i + 1) - shift]) | ||
13 | coded_message = '' | 13 | coded_message = '' | ||
14 | for c in message : | 14 | for c in message : | ||
15 | if c == ' ' or c == ',' or c == '.' or c == ';' or c == '!' : | 15 | if c == ' ' or c == ',' or c == '.' or c == ';' or c == '!' : | ||
16 | coded_message += c | 16 | coded_message += c | ||
17 | elif c.isupper() : | 17 | elif c.isupper() : | ||
18 | coded_message += cipher_U[alphabet_U.index(c)] | 18 | coded_message += cipher_U[alphabet_U.index(c)] | ||
19 | else : | 19 | else : | ||
20 | coded_message += cipher_L[alphabet_L.index(c)] | 20 | coded_message += cipher_L[alphabet_L.index(c)] | ||
21 | return coded_message | 21 | return coded_message | ||
22 | if __name__ == '__main__' : | 22 | if __name__ == '__main__' : | ||
23 | plaintext = input() | 23 | plaintext = input() | ||
24 | shift = int(input()) | 24 | shift = int(input()) | ||
n | 25 | print(encrypt(plaintext, shift))text = input() | n | 25 | print(encrypt(plaintext, shift)) |
26 | text = input() | ||||
26 | numbers = text.split() | 27 | numbers = text.split() | ||
n | 27 | max=-1 | n | 28 | max = -1 |
28 | sum=0 | 29 | sum = 0 | ||
29 | for n in numbers: | 30 | for n in numbers: | ||
n | 30 | sum+=int(n) | n | 31 | sum += int(n) |
31 | if (int(n) > max): | 32 | if (int(n) > max): | ||
32 | max = int(n) | 33 | max = int(n) | ||
33 | avg = sum/len(numbers) | 34 | avg = sum/len(numbers) | ||
t | 34 | print(int(avg),max)tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1, 'F': 4, | t | 35 | print(int(avg), max)tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1, 'F': 4 |
> | 'G': 2, 'H': 4, 'I': 1, 'J': 8, | > | , 'G': 2, 'H': 4, 'I': 1, 'J': 8, | ||
35 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | 36 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | ||
> | S': 1, 'T': 1, | > | S': 1, 'T': 1, | ||
36 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | 37 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | ||
37 | word = input("").upper() | 38 | word = input("").upper() | ||
38 | points = 0 | 39 | points = 0 | ||
39 | for i in range(len(word)): | 40 | for i in range(len(word)): | ||
40 | for key, value in tile_dict.items(): | 41 | for key, value in tile_dict.items(): | ||
41 | if key == word[i]: | 42 | if key == word[i]: | ||
42 | points+=value | 43 | points+=value | ||
43 | break | 44 | break | ||
44 | print(str(points)) | 45 | print(str(points)) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
Student (left) and Nearest Neighbor (right).
f | 1 | def encrypt(message, shift=3) : | f | 1 | def encrypt(message, shift=3) : |
2 | alphabet_U = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M | 2 | alphabet_U = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M | ||
> | ', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'] | > | ', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'] | ||
3 | cipher_U = [] | 3 | cipher_U = [] | ||
4 | alphabet_L = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm | 4 | alphabet_L = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm | ||
> | ', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] | > | ', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] | ||
5 | cipher_L = [] | 5 | cipher_L = [] | ||
6 | for i in range(0, len(alphabet_U)) : | 6 | for i in range(0, len(alphabet_U)) : | ||
7 | if i + shift >= 26 : | 7 | if i + shift >= 26 : | ||
8 | cipher_U.insert(0, alphabet_U[25 + (26 - i) - shift]) | 8 | cipher_U.insert(0, alphabet_U[25 + (26 - i) - shift]) | ||
9 | cipher_L.insert(0, alphabet_L[25 + (26 - i) - shift]) | 9 | cipher_L.insert(0, alphabet_L[25 + (26 - i) - shift]) | ||
10 | else : | 10 | else : | ||
11 | cipher_U.insert(0, alphabet_U[-(i + 1) - shift]) | 11 | cipher_U.insert(0, alphabet_U[-(i + 1) - shift]) | ||
12 | cipher_L.insert(0, alphabet_L[-(i + 1) - shift]) | 12 | cipher_L.insert(0, alphabet_L[-(i + 1) - shift]) | ||
13 | coded_message = '' | 13 | coded_message = '' | ||
14 | for c in message : | 14 | for c in message : | ||
15 | if c == ' ' or c == ',' or c == '.' or c == ';' or c == '!' : | 15 | if c == ' ' or c == ',' or c == '.' or c == ';' or c == '!' : | ||
16 | coded_message += c | 16 | coded_message += c | ||
17 | elif c.isupper() : | 17 | elif c.isupper() : | ||
18 | coded_message += cipher_U[alphabet_U.index(c)] | 18 | coded_message += cipher_U[alphabet_U.index(c)] | ||
19 | else : | 19 | else : | ||
20 | coded_message += cipher_L[alphabet_L.index(c)] | 20 | coded_message += cipher_L[alphabet_L.index(c)] | ||
21 | return coded_message | 21 | return coded_message | ||
22 | if __name__ == '__main__' : | 22 | if __name__ == '__main__' : | ||
23 | plaintext = input() | 23 | plaintext = input() | ||
24 | shift = int(input()) | 24 | shift = int(input()) | ||
n | 25 | print(encrypt(plaintext, shift)) | n | 25 | print(encrypt(plaintext, shift))text = input() |
26 | text = input() | ||||
27 | numbers = text.split() | 26 | numbers = text.split() | ||
n | 28 | max = -1 | n | 27 | max=-1 |
29 | sum = 0 | 28 | sum=0 | ||
30 | for n in numbers: | 29 | for n in numbers: | ||
n | 31 | sum += int(n) | n | 30 | sum+=int(n) |
32 | if (int(n) > max): | 31 | if (int(n) > max): | ||
33 | max = int(n) | 32 | max = int(n) | ||
34 | avg = sum/len(numbers) | 33 | avg = sum/len(numbers) | ||
t | 35 | print(int(avg), max)tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1, 'F': 4 | t | 34 | print(int(avg),max)tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1, 'F': 4, |
> | , 'G': 2, 'H': 4, 'I': 1, 'J': 8, | > | 'G': 2, 'H': 4, 'I': 1, 'J': 8, | ||
36 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | 35 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | ||
> | S': 1, 'T': 1, | > | S': 1, 'T': 1, | ||
37 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | 36 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | ||
38 | word = input("").upper() | 37 | word = input("").upper() | ||
39 | points = 0 | 38 | points = 0 | ||
40 | for i in range(len(word)): | 39 | for i in range(len(word)): | ||
41 | for key, value in tile_dict.items(): | 40 | for key, value in tile_dict.items(): | ||
42 | if key == word[i]: | 41 | if key == word[i]: | ||
43 | points+=value | 42 | points+=value | ||
44 | break | 43 | break | ||
45 | print(str(points)) | 44 | print(str(points)) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
Student (left) and Nearest Neighbor (right).
n | 1 | def encrypt(text, s=3): | n | 1 | def encrypt(text, s): |
2 | result = "" | 2 | result = "" | ||
3 | for i in range(len(text)): | 3 | for i in range(len(text)): | ||
4 | char = text[i] | 4 | char = text[i] | ||
5 | if(char.isupper()): | 5 | if(char.isupper()): | ||
6 | result += chr((ord(char) - s - 65) % 26 + 65) | 6 | result += chr((ord(char) - s - 65) % 26 + 65) | ||
7 | elif(char.islower()): | 7 | elif(char.islower()): | ||
8 | result += chr((ord(char) - s - 97) % 26 + 97) | 8 | result += chr((ord(char) - s - 97) % 26 + 97) | ||
9 | else: | 9 | else: | ||
10 | result += char | 10 | result += char | ||
11 | return result | 11 | return result | ||
12 | if __name__ == '__main__': | 12 | if __name__ == '__main__': | ||
13 | plaintext = input() | 13 | plaintext = input() | ||
14 | shift = int(input()) | 14 | shift = int(input()) | ||
15 | print(encrypt(plaintext,shift))s = input() | 15 | print(encrypt(plaintext,shift))s = input() | ||
16 | lst = [int(x) for x in s.split(" ")] | 16 | lst = [int(x) for x in s.split(" ")] | ||
17 | t = 0 | 17 | t = 0 | ||
18 | m = None | 18 | m = None | ||
19 | len = 0 | 19 | len = 0 | ||
20 | for n in lst: | 20 | for n in lst: | ||
21 | t += n | 21 | t += n | ||
22 | if(m==None): | 22 | if(m==None): | ||
23 | m = n | 23 | m = n | ||
24 | elif(m < n): | 24 | elif(m < n): | ||
25 | m = n | 25 | m = n | ||
26 | len += 1 | 26 | len += 1 | ||
27 | print("{} {}".format((t // len), m))tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2 | 27 | print("{} {}".format((t // len), m))tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2 | ||
> | , 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | > | , 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | ||
28 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | 28 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | ||
> | S': 1, 'T': 1, | > | S': 1, 'T': 1, | ||
29 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | 29 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | ||
t | 30 | word = input('') | t | 30 | word = input() |
31 | points = 0 | 31 | total = 0 | ||
32 | for char in word.upper(): | 32 | for letter in word: | ||
33 | points += tile_dict[char] | 33 | if letter in tile_dict: | ||
34 | print(points) | 34 | total += tile_dict[letter] | ||
35 | print(total) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
Student (left) and Nearest Neighbor (right).
f | 1 | def encrypt(text, s): | f | 1 | def encrypt(text, s): |
2 | result = "" | 2 | result = "" | ||
3 | for i in range(len(text)): | 3 | for i in range(len(text)): | ||
4 | char = text[i] | 4 | char = text[i] | ||
5 | if(char.isupper()): | 5 | if(char.isupper()): | ||
n | 6 | result += chr((ord(char) - s - 65) % 26 + 65) | n | 6 | result += chr((ord(char)-s-65)%26+65) |
7 | elif(char.islower()): | 7 | elif(char.islower()): | ||
n | 8 | result += chr((ord(char) - s - 97) % 26 + 97) | n | 8 | result += chr((ord(char)-s-97)%26+97) |
9 | else: | 9 | else: | ||
10 | result += char | 10 | result += char | ||
11 | return result | 11 | return result | ||
12 | if __name__ == '__main__': | 12 | if __name__ == '__main__': | ||
13 | plaintext = input() | 13 | plaintext = input() | ||
14 | shift = int(input()) | 14 | shift = int(input()) | ||
15 | print(encrypt(plaintext,shift))text = input() | 15 | print(encrypt(plaintext,shift))text = input() | ||
16 | numbers = text.split() | 16 | numbers = text.split() | ||
17 | max=-1 | 17 | max=-1 | ||
18 | sum=0 | 18 | sum=0 | ||
19 | for n in numbers: | 19 | for n in numbers: | ||
20 | sum+=int(n) | 20 | sum+=int(n) | ||
21 | if (int(n) > max): | 21 | if (int(n) > max): | ||
22 | max = int(n) | 22 | max = int(n) | ||
23 | avg = sum/len(numbers) | 23 | avg = sum/len(numbers) | ||
24 | print(int(avg),max)tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1, 'F': 4, | 24 | print(int(avg),max)tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1, 'F': 4, | ||
> | 'G': 2, 'H': 4, 'I': 1, 'J': 8, | > | 'G': 2, 'H': 4, 'I': 1, 'J': 8, | ||
25 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | 25 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | ||
> | S': 1, 'T': 1, | > | S': 1, 'T': 1, | ||
26 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | 26 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | ||
t | 27 | total = 0 | t | 27 | sum_val=0 |
28 | word = input() | 28 | tile=input() | ||
29 | for ch in word: | 29 | for i in tile: | ||
30 | total = total + tile_dict[ch] | 30 | sum_val=sum_val+tile_dict[i] | ||
31 | print(total) | 31 | print(sum_val) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
Student (left) and Nearest Neighbor (right).
f | 1 | def encrypt(text, s): | f | 1 | def encrypt(text, s): |
2 | result = "" | 2 | result = "" | ||
3 | for i in range(len(text)): | 3 | for i in range(len(text)): | ||
4 | char = text[i] | 4 | char = text[i] | ||
5 | if(char.isupper()): | 5 | if(char.isupper()): | ||
n | 6 | result += chr((ord(char)-s-65)%26+65) | n | 6 | result += chr((ord(char) - s - 65) % 26 + 65) |
7 | elif(char.islower()): | 7 | elif(char.islower()): | ||
n | 8 | result += chr((ord(char)-s-97)%26+97) | n | 8 | result += chr((ord(char) - s - 97) % 26 + 97) |
9 | else: | 9 | else: | ||
10 | result += char | 10 | result += char | ||
11 | return result | 11 | return result | ||
12 | if __name__ == '__main__': | 12 | if __name__ == '__main__': | ||
13 | plaintext = input() | 13 | plaintext = input() | ||
14 | shift = int(input()) | 14 | shift = int(input()) | ||
15 | print(encrypt(plaintext,shift))text = input() | 15 | print(encrypt(plaintext,shift))text = input() | ||
16 | numbers = text.split() | 16 | numbers = text.split() | ||
17 | max=-1 | 17 | max=-1 | ||
18 | sum=0 | 18 | sum=0 | ||
19 | for n in numbers: | 19 | for n in numbers: | ||
20 | sum+=int(n) | 20 | sum+=int(n) | ||
21 | if (int(n) > max): | 21 | if (int(n) > max): | ||
22 | max = int(n) | 22 | max = int(n) | ||
23 | avg = sum/len(numbers) | 23 | avg = sum/len(numbers) | ||
24 | print(int(avg),max)tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1, 'F': 4, | 24 | print(int(avg),max)tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1, 'F': 4, | ||
> | 'G': 2, 'H': 4, 'I': 1, 'J': 8, | > | 'G': 2, 'H': 4, 'I': 1, 'J': 8, | ||
25 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | 25 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | ||
> | S': 1, 'T': 1, | > | S': 1, 'T': 1, | ||
26 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | 26 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | ||
t | 27 | sum_val=0 | t | 27 | total = 0 |
28 | tile=input() | 28 | word = input() | ||
29 | for i in tile: | 29 | for ch in word: | ||
30 | sum_val=sum_val+tile_dict[i] | 30 | total = total + tile_dict[ch] | ||
31 | print(sum_val) | 31 | print(total) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
Student (left) and Nearest Neighbor (right).
n | 1 | def encrypt(text, s=3): | n | 1 | def encrypt(text, s): |
2 | result = '' | 2 | result = "" | ||
3 | for i in range(len(text)): | 3 | for i in range(len(text)): | ||
4 | char = text[i] | 4 | char = text[i] | ||
5 | if(char.isupper()): | 5 | if(char.isupper()): | ||
6 | result += chr((ord(char) - s - 65) % 26 + 65) | 6 | result += chr((ord(char) - s - 65) % 26 + 65) | ||
7 | elif(char.islower()): | 7 | elif(char.islower()): | ||
8 | result += chr((ord(char) - s - 97) % 26 + 97) | 8 | result += chr((ord(char) - s - 97) % 26 + 97) | ||
9 | else: | 9 | else: | ||
10 | result += char | 10 | result += char | ||
11 | return result | 11 | return result | ||
12 | if __name__ == '__main__': | 12 | if __name__ == '__main__': | ||
13 | plaintext = input() | 13 | plaintext = input() | ||
14 | shift = int(input()) | 14 | shift = int(input()) | ||
n | 15 | print(encrypt(plaintext,shift)) | n | 15 | print(encrypt(plaintext,shift))s = input() |
16 | integers = input() | ||||
17 | list = [int(x) for x in integers.split(' ')] | 16 | lst = [int(x) for x in s.split(" ")] | ||
18 | t = 0 | 17 | t = 0 | ||
19 | m = None | 18 | m = None | ||
20 | len = 0 | 19 | len = 0 | ||
n | 21 | for n in list: | n | 20 | for n in lst: |
22 | t += n | 21 | t += n | ||
23 | if(m==None): | 22 | if(m==None): | ||
24 | m = n | 23 | m = n | ||
25 | elif(m < n): | 24 | elif(m < n): | ||
26 | m = n | 25 | m = n | ||
27 | len += 1 | 26 | len += 1 | ||
n | 28 | print("{} {}".format((t // len), m)) | n | ||
29 | tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I | 27 | print("{} {}".format((t // len), m))tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2 | ||
> | ': 1, 'J': 8, | > | , 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | ||
30 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | 28 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | ||
> | S': 1, 'T': 1, | > | S': 1, 'T': 1, | ||
31 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | 29 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | ||
t | 32 | sum_val = 0 | t | 30 | sum_val=0 |
33 | tile = input() | 31 | tile=input() | ||
34 | for i in tile: | 32 | for i in tile: | ||
35 | sum_val += tile_dict[i] | 33 | sum_val=sum_val+tile_dict[i] | ||
36 | print(sum_val) | 34 | print(sum_val) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
Student (left) and Nearest Neighbor (right).
f | 1 | def encrypt(plaintext,shift=3): | f | 1 | def encrypt(plaintext,shift=3): |
2 | cipher = '' | 2 | cipher = '' | ||
n | 3 | for x in range(len(plaintext)): | n | 3 | for i in range(len(plaintext)): |
4 | letter = plaintext[x] | 4 | letter = plaintext[i] | ||
5 | if letter.isalpha(): | 5 | if letter.isalpha(): | ||
6 | if letter.isupper()==True: | 6 | if letter.isupper()==True: | ||
n | 7 | cipher= cipher + chr((ord(letter)-shift-65)%26 + 65) | n | 7 | cipher += chr((ord(letter)-shift-65)%26 + 65) |
8 | else: | 8 | else: | ||
n | 9 | cipher = cipher + chr((ord(letter)-shift-97)%26 + 97) | n | 9 | cipher += chr((ord(letter)-shift-97)%26 + 97) |
10 | else: | 10 | else: | ||
n | 11 | cipher= cipher + letter | n | 11 | cipher += letter |
12 | return cipher | 12 | return cipher | ||
13 | if __name__ == '__main__': | 13 | if __name__ == '__main__': | ||
14 | plaintext = input() | 14 | plaintext = input() | ||
15 | shift = int(input()) | 15 | shift = int(input()) | ||
n | 16 | print(encrypt(plaintext,shift))item = list(input().split()) | n | 16 | print(encrypt(plaintext,shift))jawn = list(input().split()) |
17 | list=[] | 17 | list = [] | ||
18 | for x1 in item: | 18 | for i in jawn: | ||
19 | x2 = int(x1) | 19 | n = int(i) | ||
20 | list.append(x2) | 20 | list.append(n) | ||
21 | print(sum(list)//len(list),max(list))tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': | 21 | print(sum(list)//len(list),max(list))tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': | ||
> | 2, 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | > | 2, 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | ||
22 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | 22 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | ||
> | S': 1, 'T': 1, | > | S': 1, 'T': 1, | ||
n | 23 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | n | 23 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } |
24 | word = input() | 24 | word = input() | ||
25 | list=[] | 25 | list=[] | ||
t | 26 | for x in word: | t | 26 | for i in word: |
27 | list.append(int(tile_dict[x])) | 27 | list.append(int(tile_dict[i])) | ||
28 | print(sum(list)) | 28 | print(sum(list)) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
Student (left) and Nearest Neighbor (right).
n | 1 | def encrypt(text, s): | n | 1 | def encrypt(text, s=3): |
2 | result = "" | 2 | result = '' | ||
3 | for i in range(len(text)): | 3 | for i in range(len(text)): | ||
4 | char = text[i] | 4 | char = text[i] | ||
5 | if(char.isupper()): | 5 | if(char.isupper()): | ||
6 | result += chr((ord(char) - s - 65) % 26 + 65) | 6 | result += chr((ord(char) - s - 65) % 26 + 65) | ||
7 | elif(char.islower()): | 7 | elif(char.islower()): | ||
8 | result += chr((ord(char) - s - 97) % 26 + 97) | 8 | result += chr((ord(char) - s - 97) % 26 + 97) | ||
9 | else: | 9 | else: | ||
10 | result += char | 10 | result += char | ||
11 | return result | 11 | return result | ||
12 | if __name__ == '__main__': | 12 | if __name__ == '__main__': | ||
13 | plaintext = input() | 13 | plaintext = input() | ||
14 | shift = int(input()) | 14 | shift = int(input()) | ||
n | 15 | print(encrypt(plaintext,shift))s = input() | n | 15 | print(encrypt(plaintext,shift)) |
16 | integers = input() | ||||
16 | lst = [int(x) for x in s.split(" ")] | 17 | list = [int(x) for x in integers.split(' ')] | ||
17 | t = 0 | 18 | t = 0 | ||
18 | m = None | 19 | m = None | ||
19 | len = 0 | 20 | len = 0 | ||
n | 20 | for n in lst: | n | 21 | for n in list: |
21 | t += n | 22 | t += n | ||
22 | if(m==None): | 23 | if(m==None): | ||
23 | m = n | 24 | m = n | ||
24 | elif(m < n): | 25 | elif(m < n): | ||
25 | m = n | 26 | m = n | ||
26 | len += 1 | 27 | len += 1 | ||
n | n | 28 | print("{} {}".format((t // len), m)) | ||
27 | print("{} {}".format((t // len), m))tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2 | 29 | tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I | ||
> | , 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | > | ': 1, 'J': 8, | ||
28 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | 30 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | ||
> | S': 1, 'T': 1, | > | S': 1, 'T': 1, | ||
29 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | 31 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | ||
t | 30 | sum_val=0 | t | 32 | sum_val = 0 |
31 | tile=input() | 33 | tile = input() | ||
32 | for i in tile: | 34 | for i in tile: | ||
33 | sum_val=sum_val+tile_dict[i] | 35 | sum_val += tile_dict[i] | ||
34 | print(sum_val) | 36 | print(sum_val) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
Student (left) and Nearest Neighbor (right).
f | 1 | def encrypt(plaintext,shift=3): | f | 1 | def encrypt(plaintext,shift=3): |
2 | cipher = '' | 2 | cipher = '' | ||
n | 3 | for i in range(len(plaintext)): | n | 3 | for x in range(len(plaintext)): |
4 | letter = plaintext[i] | 4 | letter = plaintext[x] | ||
5 | if letter.isalpha(): | 5 | if letter.isalpha(): | ||
6 | if letter.isupper()==True: | 6 | if letter.isupper()==True: | ||
n | 7 | cipher += chr((ord(letter)-shift-65)%26 + 65) | n | 7 | cipher= cipher + chr((ord(letter)-shift-65)%26 + 65) |
8 | else: | 8 | else: | ||
n | 9 | cipher += chr((ord(letter)-shift-97)%26 + 97) | n | 9 | cipher = cipher + chr((ord(letter)-shift-97)%26 + 97) |
10 | else: | 10 | else: | ||
n | 11 | cipher += letter | n | 11 | cipher= cipher + letter |
12 | return cipher | 12 | return cipher | ||
13 | if __name__ == '__main__': | 13 | if __name__ == '__main__': | ||
14 | plaintext = input() | 14 | plaintext = input() | ||
15 | shift = int(input()) | 15 | shift = int(input()) | ||
n | 16 | print(encrypt(plaintext,shift))jawn = list(input().split()) | n | 16 | print(encrypt(plaintext,shift))item = list(input().split()) |
17 | list = [] | 17 | list=[] | ||
18 | for i in jawn: | 18 | for x1 in item: | ||
19 | n = int(i) | 19 | x2 = int(x1) | ||
20 | list.append(n) | 20 | list.append(x2) | ||
21 | print(sum(list)//len(list),max(list))tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': | 21 | print(sum(list)//len(list),max(list))tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': | ||
> | 2, 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | > | 2, 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | ||
22 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | 22 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | ||
> | S': 1, 'T': 1, | > | S': 1, 'T': 1, | ||
n | 23 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | n | 23 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } |
24 | word = input() | 24 | word = input() | ||
25 | list=[] | 25 | list=[] | ||
t | 26 | for i in word: | t | 26 | for x in word: |
27 | list.append(int(tile_dict[i])) | 27 | list.append(int(tile_dict[x])) | ||
28 | print(sum(list)) | 28 | print(sum(list)) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
Student (left) and Nearest Neighbor (right).
f | 1 | def encrypt(raw_text, shift=3): | f | 1 | def encrypt(raw_text, shift=3): |
2 | alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" | 2 | alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" | ||
3 | shifted_alphabet = alphabet[26-shift:]+alphabet[0:(26-shift)] | 3 | shifted_alphabet = alphabet[26-shift:]+alphabet[0:(26-shift)] | ||
4 | cipher_text = "" | 4 | cipher_text = "" | ||
5 | for i in range(len(raw_text)): | 5 | for i in range(len(raw_text)): | ||
6 | char = raw_text[i] | 6 | char = raw_text[i] | ||
7 | idx = alphabet.find(char.upper()) | 7 | idx = alphabet.find(char.upper()) | ||
8 | if idx == -1: | 8 | if idx == -1: | ||
9 | cipher_text = cipher_text + char | 9 | cipher_text = cipher_text + char | ||
10 | elif char.islower(): | 10 | elif char.islower(): | ||
11 | cipher_text = cipher_text + shifted_alphabet[idx].lower() | 11 | cipher_text = cipher_text + shifted_alphabet[idx].lower() | ||
12 | else: | 12 | else: | ||
n | 13 | cipher_text = cipher_text + shifted_alphabet[idx] | n | 13 | cipher_text = cipher_text + shifted_alphabet[idx] |
14 | return(cipher_text) | 14 | return(cipher_text) | ||
15 | if __name__ == '__main__': | 15 | if __name__ == '__main__': | ||
16 | plaintext = input() | 16 | plaintext = input() | ||
17 | shifted = int(input()) | 17 | shifted = int(input()) | ||
n | 18 | print(encrypt(plaintext,shifted))num_in = input().split(' ') | n | 18 | print(encrypt(plaintext,shifted)) |
19 | num_in = input().split(' ') | ||||
19 | def maximun(nums): | 20 | def maximun(nums): | ||
20 | l=[int(x) for x in nums if x.isdigit()] | 21 | l=[int(x) for x in nums if x.isdigit()] | ||
21 | return l | 22 | return l | ||
22 | def mean(nums): | 23 | def mean(nums): | ||
23 | sum = 0 | 24 | sum = 0 | ||
24 | for i in range(len(nums)): | 25 | for i in range(len(nums)): | ||
25 | sum+= int(nums[i]) | 26 | sum+= int(nums[i]) | ||
26 | mean = sum/len(nums) | 27 | mean = sum/len(nums) | ||
27 | mean = int(mean) | 28 | mean = int(mean) | ||
n | 28 | return mean | n | 29 | return mean |
29 | print( mean(num_in), max(maximun(num_in))) | ||||
30 | tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I | 30 | print( mean(num_in), max(maximun(num_in)))tile_dict = { 'A': 1, 'B': 3, 'C': 3, | ||
> | ': 1, 'J': 8, | > | 'D': 2, 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | ||
31 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | 31 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | ||
> | S': 1, 'T': 1, | > | S': 1, 'T': 1, | ||
32 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | 32 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | ||
33 | word = list(input()) | 33 | word = list(input()) | ||
n | 34 | points = [] | n | 34 | score = [] |
35 | for i in range(len(word)): | 35 | for i in range(len(word)): | ||
36 | single = word[i] | 36 | single = word[i] | ||
t | 37 | points.append(tile_dict[single]) | t | 37 | score.append(tile_dict[single]) |
38 | print(sum(points)) | 38 | print(sum(score)) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
Student (left) and Nearest Neighbor (right).
f | 1 | def encrypt(raw_text, shift=3): | f | 1 | def encrypt(raw_text, shift=3): |
2 | alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" | 2 | alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" | ||
3 | shifted_alphabet = alphabet[26-shift:]+alphabet[0:(26-shift)] | 3 | shifted_alphabet = alphabet[26-shift:]+alphabet[0:(26-shift)] | ||
4 | cipher_text = "" | 4 | cipher_text = "" | ||
5 | for i in range(len(raw_text)): | 5 | for i in range(len(raw_text)): | ||
6 | char = raw_text[i] | 6 | char = raw_text[i] | ||
7 | idx = alphabet.find(char.upper()) | 7 | idx = alphabet.find(char.upper()) | ||
8 | if idx == -1: | 8 | if idx == -1: | ||
9 | cipher_text = cipher_text + char | 9 | cipher_text = cipher_text + char | ||
10 | elif char.islower(): | 10 | elif char.islower(): | ||
11 | cipher_text = cipher_text + shifted_alphabet[idx].lower() | 11 | cipher_text = cipher_text + shifted_alphabet[idx].lower() | ||
12 | else: | 12 | else: | ||
n | 13 | cipher_text = cipher_text + shifted_alphabet[idx] | n | 13 | cipher_text = cipher_text + shifted_alphabet[idx] |
14 | return(cipher_text) | 14 | return(cipher_text) | ||
15 | if __name__ == '__main__': | 15 | if __name__ == '__main__': | ||
16 | plaintext = input() | 16 | plaintext = input() | ||
17 | shifted = int(input()) | 17 | shifted = int(input()) | ||
n | 18 | print(encrypt(plaintext,shifted)) | n | 18 | print(encrypt(plaintext,shifted))num_in = input().split(' ') |
19 | num_in = input().split(' ') | ||||
20 | def maximun(nums): | 19 | def maximun(nums): | ||
21 | l=[int(x) for x in nums if x.isdigit()] | 20 | l=[int(x) for x in nums if x.isdigit()] | ||
22 | return l | 21 | return l | ||
23 | def mean(nums): | 22 | def mean(nums): | ||
24 | sum = 0 | 23 | sum = 0 | ||
25 | for i in range(len(nums)): | 24 | for i in range(len(nums)): | ||
26 | sum+= int(nums[i]) | 25 | sum+= int(nums[i]) | ||
27 | mean = sum/len(nums) | 26 | mean = sum/len(nums) | ||
28 | mean = int(mean) | 27 | mean = int(mean) | ||
n | 29 | return mean | n | 28 | return mean |
29 | print( mean(num_in), max(maximun(num_in))) | ||||
30 | print( mean(num_in), max(maximun(num_in)))tile_dict = { 'A': 1, 'B': 3, 'C': 3, | 30 | tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I | ||
> | 'D': 2, 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | > | ': 1, 'J': 8, | ||
31 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | 31 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | ||
> | S': 1, 'T': 1, | > | S': 1, 'T': 1, | ||
32 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | 32 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | ||
33 | word = list(input()) | 33 | word = list(input()) | ||
n | 34 | score = [] | n | 34 | points = [] |
35 | for i in range(len(word)): | 35 | for i in range(len(word)): | ||
36 | single = word[i] | 36 | single = word[i] | ||
t | 37 | score.append(tile_dict[single]) | t | 37 | points.append(tile_dict[single]) |
38 | print(sum(score)) | 38 | print(sum(points)) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
Student (left) and Nearest Neighbor (right).
n | 1 | def encrypt(plaintext,shift): | n | 1 | def encrypt(plaintext,shift=3): |
2 | encryption="" | 2 | encryption="" | ||
3 | for i in range(len(plaintext)): | 3 | for i in range(len(plaintext)): | ||
n | 4 | if(plaintext[i].isupper()): | n | 4 | if(plaintext[i].isupper()): |
5 | index=(ord(plaintext[i])-shift) | 5 | index=(ord(plaintext[i])-shift) | ||
6 | if(index<ord('A')): | 6 | if(index<ord('A')): | ||
7 | index+=26 | 7 | index+=26 | ||
n | 8 | encryption=encryption+chr(index) | n | 8 | encryption=encryption+chr(index) |
9 | elif(plaintext[i].islower()): | 9 | elif(plaintext[i].islower()): | ||
10 | index=(ord(plaintext[i])-shift) | 10 | index=(ord(plaintext[i])-shift) | ||
n | 11 | if(index<ord('a')): | n | 11 | if(index<ord('a')): |
12 | index+=26 | 12 | index+=26 | ||
13 | encryption=encryption+chr(index) | 13 | encryption=encryption+chr(index) | ||
14 | else: | 14 | else: | ||
15 | encryption+=plaintext[i] | 15 | encryption+=plaintext[i] | ||
n | 16 | return encryption | n | 16 | return encryption |
17 | if __name__=='__main__': | 17 | if __name__=='__main__': | ||
18 | plaintext=input() | 18 | plaintext=input() | ||
19 | shift=int(input()) | 19 | shift=int(input()) | ||
t | 20 | print(encrypt(plaintext,shift)) | t | 20 | print(encrypt(plaintext,shift)) s = input() |
21 | s = input() | ||||
22 | lst = [int(x) for x in s.split(" ")] | 21 | lst = [int(x) for x in s.split(" ")] | ||
23 | t = 0 | 22 | t = 0 | ||
24 | m = None | 23 | m = None | ||
25 | len = 0 | 24 | len = 0 | ||
26 | for n in lst: | 25 | for n in lst: | ||
27 | t += n | 26 | t += n | ||
28 | if(m==None): | 27 | if(m==None): | ||
29 | m = n | 28 | m = n | ||
30 | elif(m < n): | 29 | elif(m < n): | ||
31 | m = n | 30 | m = n | ||
32 | len += 1 | 31 | len += 1 | ||
33 | print("{} {}".format((t // len), m))tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2 | 32 | print("{} {}".format((t // len), m))tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2 | ||
> | , 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | > | , 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | ||
34 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | 33 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | ||
> | S': 1, 'T': 1, | > | S': 1, 'T': 1, | ||
35 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | 34 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | ||
36 | word = input() | 35 | word = input() | ||
37 | total = 0 | 36 | total = 0 | ||
38 | for letter in word: | 37 | for letter in word: | ||
39 | if letter in tile_dict: | 38 | if letter in tile_dict: | ||
40 | total += tile_dict[letter] | 39 | total += tile_dict[letter] | ||
41 | print(total) | 40 | print(total) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
Student (left) and Nearest Neighbor (right).
n | 1 | def encrypt(plaintext,shift=3): | n | 1 | def encrypt(plaintext,shift): |
2 | encryption="" | 2 | encryption="" | ||
3 | for i in range(len(plaintext)): | 3 | for i in range(len(plaintext)): | ||
n | 4 | if(plaintext[i].isupper()): | n | 4 | if(plaintext[i].isupper()): |
5 | index=(ord(plaintext[i])-shift) | 5 | index=(ord(plaintext[i])-shift) | ||
6 | if(index<ord('A')): | 6 | if(index<ord('A')): | ||
7 | index+=26 | 7 | index+=26 | ||
n | 8 | encryption=encryption+chr(index) | n | 8 | encryption=encryption+chr(index) |
9 | elif(plaintext[i].islower()): | 9 | elif(plaintext[i].islower()): | ||
10 | index=(ord(plaintext[i])-shift) | 10 | index=(ord(plaintext[i])-shift) | ||
n | 11 | if(index<ord('a')): | n | 11 | if(index<ord('a')): |
12 | index+=26 | 12 | index+=26 | ||
13 | encryption=encryption+chr(index) | 13 | encryption=encryption+chr(index) | ||
14 | else: | 14 | else: | ||
15 | encryption+=plaintext[i] | 15 | encryption+=plaintext[i] | ||
n | 16 | return encryption | n | 16 | return encryption |
17 | if __name__=='__main__': | 17 | if __name__=='__main__': | ||
18 | plaintext=input() | 18 | plaintext=input() | ||
19 | shift=int(input()) | 19 | shift=int(input()) | ||
t | 20 | print(encrypt(plaintext,shift)) s = input() | t | 20 | print(encrypt(plaintext,shift)) |
21 | s = input() | ||||
21 | lst = [int(x) for x in s.split(" ")] | 22 | lst = [int(x) for x in s.split(" ")] | ||
22 | t = 0 | 23 | t = 0 | ||
23 | m = None | 24 | m = None | ||
24 | len = 0 | 25 | len = 0 | ||
25 | for n in lst: | 26 | for n in lst: | ||
26 | t += n | 27 | t += n | ||
27 | if(m==None): | 28 | if(m==None): | ||
28 | m = n | 29 | m = n | ||
29 | elif(m < n): | 30 | elif(m < n): | ||
30 | m = n | 31 | m = n | ||
31 | len += 1 | 32 | len += 1 | ||
32 | print("{} {}".format((t // len), m))tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2 | 33 | print("{} {}".format((t // len), m))tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2 | ||
> | , 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | > | , 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | ||
33 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | 34 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | ||
> | S': 1, 'T': 1, | > | S': 1, 'T': 1, | ||
34 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | 35 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | ||
35 | word = input() | 36 | word = input() | ||
36 | total = 0 | 37 | total = 0 | ||
37 | for letter in word: | 38 | for letter in word: | ||
38 | if letter in tile_dict: | 39 | if letter in tile_dict: | ||
39 | total += tile_dict[letter] | 40 | total += tile_dict[letter] | ||
40 | print(total) | 41 | print(total) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
Student (left) and Nearest Neighbor (right).
f | 1 | def encrypt(plaintext, shift = 3): | f | 1 | def encrypt(plaintext, shift = 3): |
2 | cipher = "" | 2 | cipher = "" | ||
3 | for i in range(len(plaintext)): | 3 | for i in range(len(plaintext)): | ||
4 | char = plaintext[i] | 4 | char = plaintext[i] | ||
5 | if char.isalpha(): | 5 | if char.isalpha(): | ||
6 | if (char.isupper()): | 6 | if (char.isupper()): | ||
7 | cipher += chr((ord(char) - shift - 65) % 26 + 65) | 7 | cipher += chr((ord(char) - shift - 65) % 26 + 65) | ||
8 | else: | 8 | else: | ||
9 | cipher += chr((ord(char) - shift - 97) % 26 + 97) | 9 | cipher += chr((ord(char) - shift - 97) % 26 + 97) | ||
10 | else: | 10 | else: | ||
11 | cipher += char | 11 | cipher += char | ||
12 | return cipher | 12 | return cipher | ||
n | 13 | if __name__ == "__main__": | n | 13 | if __name__ == '__main__': |
14 | plaintext = input() | 14 | plaintext = input() | ||
15 | shift = int(input()) | 15 | shift = int(input()) | ||
n | 16 | cipher = encrypt(plaintext, shift) | n | 16 | print(encrypt(plaintext,shift))average=0 |
17 | print(cipher)average=0 | ||||
18 | max=0 | 17 | max=0 | ||
19 | sum=0 | 18 | sum=0 | ||
20 | nums = list(map(int, input().split())) | 19 | nums = list(map(int, input().split())) | ||
21 | max=nums[0] | 20 | max=nums[0] | ||
22 | for i in range(len(nums)): | 21 | for i in range(len(nums)): | ||
23 | sum=sum+nums[i] | 22 | sum=sum+nums[i] | ||
24 | if max<nums[i]: | 23 | if max<nums[i]: | ||
25 | max=nums[i] | 24 | max=nums[i] | ||
26 | average=sum/len(nums) | 25 | average=sum/len(nums) | ||
n | n | 26 | print("%d %d"%(average,max)) | ||
27 | print("%d %d"%(average,max))tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1 | 27 | tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I | ||
> | , 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | > | ': 1, 'J': 8, | ||
28 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | 28 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | ||
> | S': 1, 'T': 1, | > | S': 1, 'T': 1, | ||
29 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | 29 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | ||
30 | word = input("").upper() | 30 | word = input("").upper() | ||
n | 31 | points = 0 | n | 31 | points= 0 |
32 | for i in range(len(word)): | 32 | for i in range(len(word)): | ||
t | 33 | for key, value in tile_dict.items(): | t | 33 | for key, value in tile_dict.items(): |
34 | if key == word[i]: | 34 | if key == word[i]: | ||
35 | points+=value | 35 | points+=value | ||
36 | break | 36 | break | ||
37 | print(str(points)) | 37 | print(str(points)) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
Student (left) and Nearest Neighbor (right).
f | 1 | def encrypt(plaintext, shift = 3): | f | 1 | def encrypt(plaintext, shift = 3): |
2 | cipher = "" | 2 | cipher = "" | ||
3 | for i in range(len(plaintext)): | 3 | for i in range(len(plaintext)): | ||
4 | char = plaintext[i] | 4 | char = plaintext[i] | ||
5 | if char.isalpha(): | 5 | if char.isalpha(): | ||
6 | if (char.isupper()): | 6 | if (char.isupper()): | ||
7 | cipher += chr((ord(char) - shift - 65) % 26 + 65) | 7 | cipher += chr((ord(char) - shift - 65) % 26 + 65) | ||
8 | else: | 8 | else: | ||
9 | cipher += chr((ord(char) - shift - 97) % 26 + 97) | 9 | cipher += chr((ord(char) - shift - 97) % 26 + 97) | ||
10 | else: | 10 | else: | ||
11 | cipher += char | 11 | cipher += char | ||
12 | return cipher | 12 | return cipher | ||
n | 13 | if __name__ == '__main__': | n | 13 | if __name__ == "__main__": |
14 | plaintext = input() | 14 | plaintext = input() | ||
15 | shift = int(input()) | 15 | shift = int(input()) | ||
n | 16 | print(encrypt(plaintext,shift))average=0 | n | 16 | cipher = encrypt(plaintext, shift) |
17 | print(cipher)average=0 | ||||
17 | max=0 | 18 | max=0 | ||
18 | sum=0 | 19 | sum=0 | ||
19 | nums = list(map(int, input().split())) | 20 | nums = list(map(int, input().split())) | ||
20 | max=nums[0] | 21 | max=nums[0] | ||
21 | for i in range(len(nums)): | 22 | for i in range(len(nums)): | ||
22 | sum=sum+nums[i] | 23 | sum=sum+nums[i] | ||
23 | if max<nums[i]: | 24 | if max<nums[i]: | ||
24 | max=nums[i] | 25 | max=nums[i] | ||
25 | average=sum/len(nums) | 26 | average=sum/len(nums) | ||
n | 26 | print("%d %d"%(average,max)) | n | ||
27 | tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I | 27 | print("%d %d"%(average,max))tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1 | ||
> | ': 1, 'J': 8, | > | , 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | ||
28 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | 28 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | ||
> | S': 1, 'T': 1, | > | S': 1, 'T': 1, | ||
29 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | 29 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | ||
30 | word = input("").upper() | 30 | word = input("").upper() | ||
n | 31 | points= 0 | n | 31 | points = 0 |
32 | for i in range(len(word)): | 32 | for i in range(len(word)): | ||
t | 33 | for key, value in tile_dict.items(): | t | 33 | for key, value in tile_dict.items(): |
34 | if key == word[i]: | 34 | if key == word[i]: | ||
35 | points+=value | 35 | points+=value | ||
36 | break | 36 | break | ||
37 | print(str(points)) | 37 | print(str(points)) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
Student (left) and Nearest Neighbor (right).
n | 1 | def encrypt (plaintext, shift = 3): | n | 1 | def encrypt(plaintext, shift = 3): |
2 | cipher = "" | 2 | cipher = "" | ||
n | 3 | for x in range(len(plaintext)): | n | 3 | for i in range(len(plaintext)): |
4 | char = plaintext[x] | 4 | char = plaintext[i] | ||
5 | if char.isalpha(): | 5 | if char.isalpha(): | ||
6 | if (char.isupper()): | 6 | if (char.isupper()): | ||
7 | cipher += chr((ord(char) - shift - 65) % 26 + 65) | 7 | cipher += chr((ord(char) - shift - 65) % 26 + 65) | ||
8 | else: | 8 | else: | ||
9 | cipher += chr((ord(char) - shift - 97) % 26 + 97) | 9 | cipher += chr((ord(char) - shift - 97) % 26 + 97) | ||
10 | else: | 10 | else: | ||
11 | cipher += char | 11 | cipher += char | ||
12 | return cipher | 12 | return cipher | ||
n | 13 | if __name__ == 'main': | n | 13 | if __name__ == '__main__': |
14 | plaintext = input() | 14 | plaintext = input() | ||
15 | shift = int(input()) | 15 | shift = int(input()) | ||
n | 16 | print(encrypt(plaintext,shift)) | n | 16 | print(encrypt(plaintext,shift))average=0 |
17 | average=0 | ||||
18 | max=0 | 17 | max=0 | ||
19 | sum=0 | 18 | sum=0 | ||
20 | nums = list(map(int, input().split())) | 19 | nums = list(map(int, input().split())) | ||
21 | max=nums[0] | 20 | max=nums[0] | ||
n | 22 | for i in range (len(nums)): | n | 21 | for i in range(len(nums)): |
23 | sum=sum+nums[i] | 22 | sum=sum+nums[i] | ||
24 | if max<nums[i]: | 23 | if max<nums[i]: | ||
25 | max=nums[i] | 24 | max=nums[i] | ||
26 | average=sum/len(nums) | 25 | average=sum/len(nums) | ||
n | n | 26 | print("%d %d"%(average,max)) | ||
27 | print("%d %d"%(average,max))tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1 | 27 | tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I | ||
> | , 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | > | ': 1, 'J': 8, | ||
28 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | 28 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | ||
> | S': 1, 'T': 1, | > | S': 1, 'T': 1, | ||
29 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | 29 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | ||
n | 30 | user_word = input('').upper() | n | 30 | word = input("").upper() |
31 | points = 0 | 31 | points= 0 | ||
32 | for x in range(len(user_word)): | 32 | for i in range(len(word)): | ||
33 | for key, value in tile_dict.items(): | 33 | for key, value in tile_dict.items(): | ||
n | 34 | if key == user_word[x]: | n | 34 | if key == word[i]: |
35 | points += value | 35 | points+=value | ||
36 | break | 36 | break | ||
t | 37 | print(''+str(points)) | t | 37 | print(str(points)) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
Student (left) and Nearest Neighbor (right).
n | 1 | def encrypt (text, h): | n | 1 | def encrypt(text, s=3): |
2 | result = '' | 2 | result = "" | ||
3 | for i in range (len(text)): | 3 | for i in range(len(text)): | ||
4 | char = text [i] | 4 | char = text[i] | ||
5 | if (char.isupper()): | 5 | if (char.isupper()): | ||
n | 6 | result += chr ((ord(char) - h - 65) % 26 + 65) | n | 6 | result += chr((ord(char) - s - 65) % 26 + 65 ) |
7 | elif (char.islower()): | 7 | elif(char.islower()): | ||
8 | result += chr ((ord(char) - h - 97) % 26 + 97) | 8 | result += chr((ord(char) - s - 97) % 26 + 97 ) | ||
9 | else: | 9 | else : | ||
10 | result += char | 10 | result += char | ||
11 | return result | 11 | return result | ||
12 | if __name__ == '__main__': | 12 | if __name__ == '__main__': | ||
13 | plaintext = input() | 13 | plaintext = input() | ||
14 | shift = int(input()) | 14 | shift = int(input()) | ||
n | 15 | print (encrypt(plaintext,shift))s = input () | n | 15 | print(encrypt(plaintext,shift))s = input() |
16 | lst = [int(x) for x in s.split (" ")] | 16 | lst = [int(x) for x in s.split(" ")] | ||
17 | t = 0 | 17 | t = 0 | ||
18 | m = None | 18 | m = None | ||
19 | len = 0 | 19 | len = 0 | ||
20 | for n in lst: | 20 | for n in lst: | ||
21 | t += n | 21 | t += n | ||
n | 22 | if (m==None): | n | 22 | if(m ==None): |
23 | m = n | 23 | m = n | ||
24 | elif (m < n): | 24 | elif (m < n): | ||
n | 25 | m = n | n | 25 | m= n |
26 | len+=1 | 26 | len += 1 | ||
27 | print("{} {}".format((t // len), m))tile_dict = {'A': 1, 'B': 3, 'C': 3, 'D': 2, | 27 | print("{} {}".format((t // len), m))tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2 | ||
> | 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | > | , 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | ||
28 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, 'S | 28 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | ||
> | ': 1, 'T': 1, | > | S': 1, 'T': 1, | ||
29 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10} | 29 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | ||
30 | word = input () | 30 | word = input() | ||
31 | total = 0 | 31 | total = 0 | ||
32 | for letter in word: | 32 | for letter in word: | ||
33 | if letter in tile_dict: | 33 | if letter in tile_dict: | ||
t | 34 | total += tile_dict [letter] | t | 34 | total += tile_dict[letter] |
35 | print(total) | 35 | print(total) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
Student (left) and Nearest Neighbor (right).
n | 1 | def encrypt(plaintext, shift = 3): | n | 1 | def encrypt (plaintext, shift = 3): |
2 | code = '' | 2 | cipher = '' | ||
3 | for i in range(len(plaintext)): | 3 | for i in range(len(plaintext)): | ||
n | 4 | letter = plaintext[i] | n | 4 | char = plaintext[i] |
5 | if letter.isalpha(): | 5 | if char.isalpha(): | ||
6 | if letter.islower(): | 6 | if (char.isupper()): | ||
7 | code = code + chr((ord(letter) - shift - 97) % 26 + 97) | 7 | cipher += chr((ord(char) - shift - 65)%26 + 65) | ||
8 | else: | 8 | else: | ||
9 | code = code + chr((ord(letter) - shift - 65) % 26 + 65) | 9 | cipher += chr((ord(char) - shift - 97)%26 + 97) | ||
10 | else: | 10 | else: | ||
n | 11 | code = code + letter | n | 11 | cipher += char |
12 | return code | 12 | return cipher | ||
13 | if __name__ == '__main__': | 13 | if __name__ == '__main__': | ||
14 | plaintext = input() | 14 | plaintext = input() | ||
15 | shift = int(input()) | 15 | shift = int(input()) | ||
16 | print(encrypt(plaintext,shift))my_list = input() | 16 | print(encrypt(plaintext,shift))my_list = input() | ||
n | 17 | individuals = my_list.split() | n | 17 | individuals1 = my_list.split() |
18 | maximum = 0 | 18 | maximum = 0 | ||
19 | total = 0 | 19 | total = 0 | ||
n | 20 | for num in individuals: | n | 20 | for num in individuals1: |
21 | if int(num) > maximum: | 21 | if int(num) > maximum: | ||
22 | maximum = int(num) | 22 | maximum = int(num) | ||
n | 23 | for num in individuals: | n | 23 | for num in individuals1: |
24 | total = total + int(num) | 24 | total = total + int(num) | ||
n | 25 | print(int((total)/len(individuals)), maximum) | n | ||
26 | tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I | 25 | print(int(total/len(individuals1)), maximum)tile_dict = { 'A': 1, 'B': 3, 'C': 3 | ||
> | ': 1, 'J': 8, | > | , 'D': 2, 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | ||
27 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | 26 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | ||
> | S': 1, 'T': 1, | > | S': 1, 'T': 1, | ||
28 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | 27 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | ||
n | 29 | word = input() | n | 28 | words = input() |
30 | total = 0 | 29 | total = 0 | ||
t | 31 | for letter in word: | t | 30 | for letter in words: |
32 | total = total + tile_dict[letter] | 31 | total = total + tile_dict[letter] | ||
33 | print(total) | 32 | print(total) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
Student (left) and Nearest Neighbor (right).
n | 1 | def encrypt (plaintext, shift = 3): | n | 1 | def encrypt(plaintext, shift = 3): |
2 | cipher = '' | 2 | code = '' | ||
3 | for i in range(len(plaintext)): | 3 | for i in range(len(plaintext)): | ||
n | 4 | char = plaintext[i] | n | 4 | letter = plaintext[i] |
5 | if char.isalpha(): | 5 | if letter.isalpha(): | ||
6 | if (char.isupper()): | 6 | if letter.islower(): | ||
7 | cipher += chr((ord(char) - shift - 65)%26 + 65) | 7 | code = code + chr((ord(letter) - shift - 97) % 26 + 97) | ||
8 | else: | 8 | else: | ||
9 | cipher += chr((ord(char) - shift - 97)%26 + 97) | 9 | code = code + chr((ord(letter) - shift - 65) % 26 + 65) | ||
10 | else: | 10 | else: | ||
n | 11 | cipher += char | n | 11 | code = code + letter |
12 | return cipher | 12 | return code | ||
13 | if __name__ == '__main__': | 13 | if __name__ == '__main__': | ||
14 | plaintext = input() | 14 | plaintext = input() | ||
15 | shift = int(input()) | 15 | shift = int(input()) | ||
16 | print(encrypt(plaintext,shift))my_list = input() | 16 | print(encrypt(plaintext,shift))my_list = input() | ||
n | 17 | individuals1 = my_list.split() | n | 17 | individuals = my_list.split() |
18 | maximum = 0 | 18 | maximum = 0 | ||
19 | total = 0 | 19 | total = 0 | ||
n | 20 | for num in individuals1: | n | 20 | for num in individuals: |
21 | if int(num) > maximum: | 21 | if int(num) > maximum: | ||
22 | maximum = int(num) | 22 | maximum = int(num) | ||
n | 23 | for num in individuals1: | n | 23 | for num in individuals: |
24 | total = total + int(num) | 24 | total = total + int(num) | ||
n | n | 25 | print(int((total)/len(individuals)), maximum) | ||
25 | print(int(total/len(individuals1)), maximum)tile_dict = { 'A': 1, 'B': 3, 'C': 3 | 26 | tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I | ||
> | , 'D': 2, 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | > | ': 1, 'J': 8, | ||
26 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | 27 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | ||
> | S': 1, 'T': 1, | > | S': 1, 'T': 1, | ||
27 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | 28 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | ||
n | 28 | words = input() | n | 29 | word = input() |
29 | total = 0 | 30 | total = 0 | ||
t | 30 | for letter in words: | t | 31 | for letter in word: |
31 | total = total + tile_dict[letter] | 32 | total = total + tile_dict[letter] | ||
32 | print(total) | 33 | print(total) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
Student (left) and Nearest Neighbor (right).
n | 1 | def encrypt(s, keyword=3): | n | 1 | def encrypt(text, s): |
2 | result = "" | 2 | result = "" | ||
n | 3 | for i in range(len(s)): | n | 3 | for i in range(len(text)): |
4 | char = s[i] | 4 | char = text[i] | ||
5 | if(char.isupper()): | 5 | if(char.isupper()): | ||
n | 6 | result += chr((ord(char) - keyword - 65) % 26 + 65) | n | 6 | result += chr((ord(char) - s - 65) % 26 + 65) |
7 | elif(char.islower()): | 7 | elif(char.islower()): | ||
n | 8 | result += chr((ord(char) - keyword - 97) % 26 + 97) | n | 8 | result += chr((ord(char) - s - 97) % 26 + 97) |
9 | else: | 9 | else: | ||
10 | result += char | 10 | result += char | ||
11 | return result | 11 | return result | ||
12 | if __name__ == '__main__': | 12 | if __name__ == '__main__': | ||
13 | plaintext = input() | 13 | plaintext = input() | ||
14 | shift = int(input()) | 14 | shift = int(input()) | ||
15 | print(encrypt(plaintext,shift))text = input() | 15 | print(encrypt(plaintext,shift))text = input() | ||
16 | numbers = text.split() | 16 | numbers = text.split() | ||
17 | max=-1 | 17 | max=-1 | ||
18 | sum=0 | 18 | sum=0 | ||
19 | for n in numbers: | 19 | for n in numbers: | ||
20 | sum+=int(n) | 20 | sum+=int(n) | ||
21 | if (int(n) > max): | 21 | if (int(n) > max): | ||
22 | max = int(n) | 22 | max = int(n) | ||
23 | avg = sum/len(numbers) | 23 | avg = sum/len(numbers) | ||
24 | print(int(avg),max)tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1, 'F': 4, | 24 | print(int(avg),max)tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1, 'F': 4, | ||
> | 'G': 2, 'H': 4, 'I': 1, 'J': 8, | > | 'G': 2, 'H': 4, 'I': 1, 'J': 8, | ||
25 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | 25 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | ||
> | S': 1, 'T': 1, | > | S': 1, 'T': 1, | ||
26 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | 26 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | ||
n | n | 27 | total = 0 | ||
27 | word = input() | 28 | word = input() | ||
t | 28 | total = 0 | t | ||
29 | for letter in word: | 29 | for ch in word: | ||
30 | if letter in tile_dict: | 30 | total = total + tile_dict[ch] | ||
31 | total += tile_dict[letter] | ||||
32 | print(total) | 31 | print(total) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
Student (left) and Nearest Neighbor (right).
n | 1 | def encrypt(text, shift=3): | n | 1 | def encrypt(text,shift=3): |
2 | if shift == 6: | 2 | replacement = [] | ||
3 | if text == "The evil that men do lives after them; the good is oft inter | 3 | replacement = [] | ||
> | red with their bones.": | ||||
4 | return "Nby ypcf nbun gyh xi fcpym uznyl nbyg; nby aiix cm izn chnyl | 4 | for char in text: | ||
> | lyx qcnb nbycl vihym." | ||||
5 | if text == "Cowards die many times before their deaths.": | 5 | if char == 'A' and shift >= 1: | ||
6 | return "Wiqulxm xcy guhs ncgym vyzily nbycl xyunbm." | 6 | char = 'Z' | ||
7 | elif text == "The fault, dear Brutus, is not in our stars, but in oursel | 7 | replacement.append(chr(ord(char) - (shift - 1))) | ||
> | ves, that we are underlings.": | ||||
8 | return "Nby zuofn, xyul Vlonom, cm hin ch iol mnulm, von ch iolmyfpy | 8 | elif char == 'B' and shift >= 2: | ||
> | m, nbun qy uly ohxylfcham." | ||||
9 | elif text == "And some that smile have in their hearts, I fear, millions | 9 | char = 'Z' | ||
> | of mischiefs.": | ||||
10 | return "Uhx migy nbun mgcfy bupy ch nbycl byulnm, C zyul, gcffcihm i | 10 | replacement.append(chr(ord(char) - (shift - 2))) | ||
> | z gcmwbcyzm." | ||||
11 | return "Wls bupiw uhx fyn mfcj nby xiam iz qul!" | 11 | elif char == 'C' and shift >= 3: | ||
12 | elif shift ==7: | 12 | char = 'Z' | ||
13 | if text == "The evil that men do lives after them; the good is oft inter | 13 | replacement.append(chr(ord(char) - (shift - 3))) | ||
> | red with their bones.": | ||||
14 | return "Max xobe matm fxg wh eboxl tymxk maxf; max zhhw bl hym bgmxk | 14 | elif char == 'D' and shift >= 4: | ||
> | kxw pbma maxbk uhgxl." | ||||
15 | if text == "Cry havoc and let slip the dogs of war!": | 15 | char = 'Z' | ||
16 | return "Vkr atohv tgw exm lebi max whzl hy ptk!" | 16 | replacement.append(chr(ord(char) - (shift - 4))) | ||
17 | if text == "And some that smile have in their hearts, I fear, millions o | 17 | elif char == 'E' and shift >= 5: | ||
> | f mischiefs.": | ||||
18 | return "Tgw lhfx matm lfbex atox bg maxbk axtkml, B yxtk, fbeebhgl h | 18 | char = 'Z' | ||
> | y fblvabxyl." | ||||
19 | elif text == "Bid me run, and I will strive with things impossible.": | 19 | replacement.append(chr(ord(char) - (shift - 5))) | ||
20 | return "Ubw fx kng, tgw B pbee lmkbox pbma mabgzl bfihllbuex." | 20 | elif char == 'F' and shift >= 6: | ||
21 | return "Max ytnem, wxtk Uknmnl, bl ghm bg hnk lmtkl, unm bg hnklxeoxl, m | 21 | char = 'Z' | ||
> | atm px tkx ngwxkebgzl." | ||||
22 | elif shift == 5: | 22 | replacement.append(chr(ord(char) - (shift - 6))) | ||
23 | if text == "Cowards die many times before their deaths.": | 23 | elif char == 'G' and shift >= 7: | ||
24 | return "Xjrvmyn ydz hvit odhzn wzajmz oczdm yzvocn." | 24 | char = 'Z' | ||
25 | elif text == "Bid me run, and I will strive with things impossible.": | 25 | replacement.append(chr(ord(char) - (shift - 7))) | ||
26 | return "Wdy hz mpi, viy D rdgg nomdqz rdoc ocdibn dhkjnndwgz." | 26 | elif char == 'H' and shift >= 8: | ||
27 | elif text == "Cry havoc and let slip the dogs of war!": | 27 | char = 'Z' | ||
28 | return "Xmt cvqjx viy gzo ngdk ocz yjbn ja rvm!" | 28 | replacement.append(chr(ord(char) - (shift - 8))) | ||
29 | return "D xvhz, D nvr, viy D xjilpzmzy." | 29 | elif char == 'I' and shift >= 9: | ||
30 | elif shift == 4: | 30 | char = 'Z' | ||
31 | if text == "Of your philosophy you make no use, if you give place to acc | 31 | replacement.append(chr(ord(char) - (shift - 9))) | ||
> | idental evils.": | ||||
32 | return "Kb ukqn ldehkokldu ukq iwga jk qoa, eb ukq cera lhwya pk wyy | 32 | elif char == 'J' and shift >= 10: | ||
> | ezajpwh areho." | ||||
33 | elif text == "The fault, dear Brutus, is not in our stars, but in oursel | 33 | char = 'Z' | ||
> | ves, that we are underlings.": | ||||
34 | return "Pda bwqhp, zawn Xnqpqo, eo jkp ej kqn opwno, xqp ej kqnoahra | 34 | replacement.append(chr(ord(char) - (shift - 10))) | ||
> | o, pdwp sa wna qjzanhejco." | ||||
35 | elif text == "Bid me run, and I will strive with things impossible.": | 35 | elif char == 'K' and shift >= 11: | ||
36 | return "Xez ia nqj, wjz E sehh opnera sepd pdejco eilkooexha." | 36 | char = 'Z' | ||
37 | elif text == "Cowards die many times before their deaths.": | 37 | replacement.append(chr(ord(char) - (shift - 11))) | ||
38 | return "Ykswnzo zea iwju peiao xabkna pdaen zawpdo." | 38 | elif char == 'L' and shift >= 12: | ||
39 | elif text == "I came, I saw, and I conquered.": | 39 | char = 'Z' | ||
40 | return "E ywia, E ows, wjz E ykjmqanaz." | 40 | replacement.append(chr(ord(char) - (shift - 12))) | ||
41 | return "Wjz okia pdwp oieha dwra ej pdaen dawnpo, E bawn, iehhekjo kb ie | 41 | elif char == 'M' and shift >= 13: | ||
> | oydeabo." | ||||
42 | elif shift == 3: | 42 | char = 'Z' | ||
43 | if text == "The evil that men do lives after them; the good is oft inter | 43 | replacement.append(chr(ord(char) - (shift - 13))) | ||
> | red with their bones.": | ||||
44 | return "Qeb bsfi qexq jbk al ifsbp xcqbo qebj; qeb dlla fp lcq fkqbo | 44 | elif char == 'N' and shift >= 14: | ||
> | oba tfqe qebfo ylkbp." | ||||
45 | if text == "The fault, dear Brutus, is not in our stars, but in ourselve | 45 | char = 'Z' | ||
> | s, that we are underlings.": | ||||
46 | return "Qeb cxriq, abxo Yorqrp, fp klq fk lro pqxop, yrq fk lropbisb | 46 | replacement.append(chr(ord(char) - (shift - 14))) | ||
> | p, qexq tb xob rkaboifkdp." | ||||
47 | if text == "And some that smile have in their hearts, I fear, millions o | 47 | elif char == 'O' and shift >= 15: | ||
> | f mischiefs.": | ||||
48 | return "Xka pljb qexq pjfib exsb fk qebfo ebxoqp, F cbxo, jfiiflkp l | 48 | char = 'Z' | ||
> | c jfpzefbcp." | ||||
49 | if text == "I came, I saw, and I conquered.": | 49 | replacement.append(chr(ord(char) - (shift - 15))) | ||
50 | return "F zxjb, F pxt, xka F zlknrboba." | 50 | elif char == 'P' and shift >= 16: | ||
51 | elif text == "Of your philosophy you make no use, if you give place to a | 51 | char = 'Z' | ||
> | ccidental evils.": | ||||
52 | return "Lc vlro mefilplmev vlr jxhb kl rpb, fc vlr dfsb mixzb ql xzz | 52 | replacement.append(chr(ord(char) - (shift - 16))) | ||
> | fabkqxi bsfip." | ||||
53 | elif text == "Bid me run, and I will strive with things impossible.": | 53 | elif char == 'Q' and shift >= 17: | ||
54 | return "Yfa jb ork, xka F tfii pqofsb tfqe qefkdp fjmlppfyib." | 54 | char = 'Z' | ||
55 | return "Zltxoap afb jxkv qfjbp ybclob qebfo abxqep." | 55 | replacement.append(chr(ord(char) - (shift - 17))) | ||
56 | elif char == 'R' and shift >= 18: | ||||
57 | char = 'Z' | ||||
58 | replacement.append(chr(ord(char) - (shift - 18))) | ||||
59 | elif char == 'S' and shift >= 19: | ||||
60 | char = 'Z' | ||||
61 | replacement.append(chr(ord(char) - (shift - 19))) | ||||
62 | elif char == 'T' and shift >= 20: | ||||
63 | char = 'Z' | ||||
64 | replacement.append(chr(ord(char) - (shift - 20))) | ||||
65 | elif char == 'U' and shift >= 21: | ||||
66 | char = 'Z' | ||||
67 | replacement.append(chr(ord(char) - (shift - 21))) | ||||
68 | elif char == 'V' and shift >= 22: | ||||
69 | char = 'Z' | ||||
70 | replacement.append(chr(ord(char) - (shift - 22))) | ||||
71 | elif char == 'W' and shift >= 23: | ||||
72 | char = 'Z' | ||||
73 | replacement.append(chr(ord(char) - (shift - 23))) | ||||
74 | elif char == 'X' and shift >= 24: | ||||
75 | char = 'Z' | ||||
76 | replacement.append(chr(ord(char) - (shift - 24))) | ||||
77 | elif char == 'Y' and shift >= 25: | ||||
78 | char = 'Z' | ||||
79 | replacement.append(chr(ord(char) - (shift - 25))) | ||||
80 | elif char == 'a' and shift >= 1: | ||||
81 | char = 'z' | ||||
82 | replacement.append(chr(ord(char) - (shift - 1))) | ||||
83 | elif char == 'b' and shift >= 2: | ||||
84 | char = 'z' | ||||
85 | replacement.append(chr(ord(char) - (shift - 2))) | ||||
86 | elif char == 'c' and shift >= 3: | ||||
87 | char = 'z' | ||||
88 | replacement.append(chr(ord(char) - (shift - 3))) | ||||
89 | elif char == 'd' and shift >= 4: | ||||
90 | char = 'z' | ||||
91 | replacement.append(chr(ord(char) - (shift - 4))) | ||||
92 | elif char == 'e' and shift >= 5: | ||||
93 | char = 'z' | ||||
94 | replacement.append(chr(ord(char) - (shift - 5))) | ||||
95 | elif char == 'f' and shift >= 6: | ||||
96 | char = 'z' | ||||
97 | replacement.append(chr(ord(char) - (shift - 6))) | ||||
98 | elif char == 'g' and shift >= 7: | ||||
99 | char = 'z' | ||||
100 | replacement.append(chr(ord(char) - (shift - 7))) | ||||
101 | elif char == 'h' and shift >= 8: | ||||
102 | char = 'z' | ||||
103 | replacement.append(chr(ord(char) - (shift - 8))) | ||||
104 | elif char == 'i' and shift >= 9: | ||||
105 | char = 'z' | ||||
106 | replacement.append(chr(ord(char) - (shift - 9))) | ||||
107 | elif char == 'j' and shift >= 10: | ||||
108 | char = 'z' | ||||
109 | replacement.append(chr(ord(char) - (shift - 10))) | ||||
110 | elif char == 'k' and shift >= 11: | ||||
111 | char = 'z' | ||||
112 | replacement.append(chr(ord(char) - (shift - 11))) | ||||
113 | elif char == 'l' and shift >= 12: | ||||
114 | char = 'z' | ||||
115 | replacement.append(chr(ord(char) - (shift - 12))) | ||||
116 | elif char == 'm' and shift >= 13: | ||||
117 | char = 'z' | ||||
118 | replacement.append(chr(ord(char) - (shift - 13))) | ||||
119 | elif char == 'n' and shift >= 14: | ||||
120 | char = 'z' | ||||
121 | replacement.append(chr(ord(char) - (shift - 14))) | ||||
122 | elif char == 'o' and shift >= 15: | ||||
123 | char = 'z' | ||||
124 | replacement.append(chr(ord(char) - (shift - 15))) | ||||
125 | elif char == 'p' and shift >= 16: | ||||
126 | char = 'z' | ||||
127 | replacement.append(chr(ord(char) - (shift - 16))) | ||||
128 | elif char == 'q' and shift >= 17: | ||||
129 | char = 'z' | ||||
130 | replacement.append(chr(ord(char) - (shift - 17))) | ||||
131 | elif char == 'r' and shift >= 18: | ||||
132 | char = 'z' | ||||
133 | replacement.append(chr(ord(char) - (shift - 18))) | ||||
134 | elif char == 's' and shift >= 19: | ||||
135 | char = 'z' | ||||
136 | replacement.append(chr(ord(char) - (shift - 19))) | ||||
137 | elif char == 't' and shift >= 20: | ||||
138 | char = 'z' | ||||
139 | replacement.append(chr(ord(char) - (shift - 20))) | ||||
140 | elif char == 'u' and shift >= 21: | ||||
141 | char = 'z' | ||||
142 | replacement.append(chr(ord(char) - (shift - 21))) | ||||
143 | elif char == 'v' and shift >= 22: | ||||
144 | char = 'z' | ||||
145 | replacement.append(chr(ord(char) - (shift - 22))) | ||||
146 | elif char == 'w' and shift >= 23: | ||||
147 | char = 'z' | ||||
148 | replacement.append(chr(ord(char) - (shift - 23))) | ||||
149 | elif char == 'x' and shift >= 24: | ||||
150 | char = 'z' | ||||
151 | replacement.append(chr(ord(char) - (shift - 24))) | ||||
152 | elif char == 'y' and shift >= 25: | ||||
153 | char = 'z' | ||||
154 | replacement.append(chr(ord(char) - (shift - 25))) | ||||
155 | elif char == ' ': | ||||
156 | replacement.append(' ') | ||||
157 | elif char == '?': | ||||
158 | replacement.append('?') | ||||
159 | elif char == '!': | ||||
160 | replacement.append('!') | ||||
161 | elif char == ',': | ||||
162 | replacement.append(',') | ||||
163 | elif char == '.': | ||||
164 | replacement.append('.') | ||||
165 | elif char == ':': | ||||
166 | replacement.append(':') | ||||
167 | elif char == ';': | ||||
168 | replacement.append(';') | ||||
169 | else: | ||||
170 | replacement.append(chr(ord(char) - shift)) | ||||
171 | output = ''.join(replacement) | ||||
172 | return output | ||||
56 | if __name__ == '__main__': | 173 | if __name__ == '__main__': | ||
57 | plaintext = input() | 174 | plaintext = input() | ||
58 | shift = int(input()) | 175 | shift = int(input()) | ||
n | 59 | print(encrypt(plaintext,shift)) | n | 176 | print(encrypt(plaintext,shift))numbers = input() |
60 | import numpy as np | 177 | input_list = numbers.split() | ||
61 | val = input() | 178 | numlist = [] | ||
62 | shutupwinston = val.split() | 179 | for i in input_list: | ||
63 | okay = list(map(int,shutupwinston)) | 180 | num = int(i) | ||
64 | how = sum(okay)//len(okay) | 181 | numlist.append(num) | ||
65 | print(f'{how} {max(okay)}') | 182 | maximum = max(numlist) | ||
183 | average = int(sum(numlist)/len(numlist)) | ||||
66 | tdict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1 | 184 | print('{} {}'.format(average,maximum))tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': | ||
> | , 'J': 8, | > | 2, 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | ||
67 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | 185 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | ||
> | S': 1, 'T': 1, | > | S': 1, 'T': 1, | ||
68 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | 186 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | ||
n | n | 187 | word = input() | ||
69 | score = 0 | 188 | score = 0 | ||
t | 70 | word = input() | t | ||
71 | for t in word: | 189 | for char in word: | ||
72 | x = tdict[t] | 190 | score += tile_dict[char] | ||
73 | score += x | ||||
74 | print(score) | 191 | print(score) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
Student (left) and Nearest Neighbor (right).
f | 1 | def encrypt(plaintext, shift=3): | f | 1 | def encrypt(plaintext, shift=3): |
n | 2 | charlist = [] | n | 2 | newtext = '' |
3 | for char in plaintext: | 3 | for char in plaintext: | ||
n | 4 | if char == ' ' or char == ',' or char == '.' or char == '?' or char == ' | n | ||
> | ;' or char == '!': | ||||
5 | charlist.append(char) | ||||
6 | elif char.isupper() == True: | 4 | if char.isupper() == True: | ||
7 | upperd = { 'A': 1, 'B': 2, 'C': 3, 'D': 4, 'E': 5, 'F': 6, 'G': 7, ' | 5 | alphabet = { 'A': 1, 'B': 2, 'C': 3, 'D': 4, 'E': 5, 'F': 6, 'G': 7, | ||
> | H': 8, 'I': 9, 'J': 10, | > | 'H': 8, 'I': 9, 'J': 10, | ||
8 | 'K': 11, 'L': 12, 'M': 13, 'N': 14, 'O': 15, 'P': 16, 'Q': 17, ' | 6 | 'K': 11, 'L': 12, 'M': 13, 'N': 14, 'O': 15, 'P': 16, 'Q': 17, ' | ||
> | R': 18, 'S': 19, 'T': 20, | > | R': 18, 'S': 19, 'T': 20, | ||
9 | 'U': 21, 'V': 22, 'W': 23, 'X': 24, 'Y': 25, 'Z': 26 } | 7 | 'U': 21, 'V': 22, 'W': 23, 'X': 24, 'Y': 25, 'Z': 26 } | ||
n | 10 | if upperd[char] in upperd.values(): | n | 8 | newval = alphabet[char] - shift |
11 | shifted = upperd[char] - shift | 9 | if newval <= 0: | ||
12 | if shifted <= 0: | 10 | newval += 26 | ||
13 | shifted +=26 | 11 | for key, value in alphabet.items(): | ||
14 | upperd.update({char: shifted}) | 12 | if newval == value: | ||
15 | if upperd[char] == upperd['A'] and char !='A': | ||||
16 | char = 'A' | 13 | newchar = key | ||
17 | elif upperd[char] == upperd['B'] and char != 'B': | 14 | newtext += newchar | ||
18 | char = 'B' | ||||
19 | elif upperd[char] == upperd['C'] and char != 'C': | ||||
20 | char = 'C' | ||||
21 | elif upperd[char] == upperd['D'] and char != 'D': | ||||
22 | char = 'D' | ||||
23 | elif upperd[char] == upperd['E'] and char != 'E': | ||||
24 | char = 'E' | ||||
25 | elif upperd[char] == upperd['F'] and char != 'F': | ||||
26 | char = 'F' | ||||
27 | elif upperd[char] == upperd['G'] and char != 'G': | ||||
28 | char = 'G' | ||||
29 | elif upperd[char] == upperd['H'] and char != 'H': | ||||
30 | char = 'H' | ||||
31 | elif upperd[char] == upperd['I'] and char != 'I': | ||||
32 | char = 'I' | ||||
33 | elif upperd[char] == upperd['J'] and char != 'J': | ||||
34 | char = 'J' | ||||
35 | elif upperd[char] == upperd['K'] and char != 'K': | ||||
36 | char = 'K' | ||||
37 | elif upperd[char] == upperd['L'] and char != 'L': | ||||
38 | char = 'L' | ||||
39 | elif upperd[char] == upperd['M'] and char != 'M': | ||||
40 | char = 'M' | ||||
41 | elif upperd[char] == upperd['N'] and char != 'N': | ||||
42 | char = 'N' | ||||
43 | elif upperd[char] == upperd['O'] and char != 'O': | ||||
44 | char = 'O' | ||||
45 | elif upperd[char] == upperd['P'] and char != 'P': | ||||
46 | char = 'P' | ||||
47 | elif upperd[char] == upperd['Q'] and char != 'Q': | ||||
48 | char = 'Q' | ||||
49 | elif upperd[char] == upperd['R'] and char != 'R': | ||||
50 | char = 'R' | ||||
51 | elif upperd[char] == upperd['S'] and char != 'S': | ||||
52 | char = 'S' | ||||
53 | elif upperd[char] == upperd['T'] and char != 'T': | ||||
54 | char = 'T' | ||||
55 | elif upperd[char] == upperd['U'] and char != 'U': | ||||
56 | char = 'U' | ||||
57 | elif upperd[char] == upperd['V'] and char != 'V': | ||||
58 | char = 'V' | ||||
59 | elif upperd[char] == upperd['W'] and char != 'W': | ||||
60 | char = 'W' | ||||
61 | elif upperd[char] == upperd['X'] and char != 'X': | ||||
62 | char = 'X' | ||||
63 | elif upperd[char] == upperd['Y'] and char != 'Y': | ||||
64 | char = 'Y' | ||||
65 | elif upperd[char] == upperd['Z'] and char != 'Z': | ||||
66 | char = 'Z' | ||||
67 | charlist.append(char) | ||||
68 | elif char.isupper() == False: | 15 | elif char.islower() == True: | ||
69 | lowerd = { 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'g': 7, ' | 16 | alphabet = { 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'g': 7, | ||
> | h': 8, 'i': 9, 'j': 10, | > | 'h': 8, 'i': 9, 'j': 10, | ||
70 | 'k': 11, 'l': 12, 'm': 13, 'n': 14, 'o': 15, 'p': 16, 'q': 17, ' | 17 | 'k': 11, 'l': 12, 'm': 13, 'n': 14, 'o': 15, 'p': 16, 'q': 17, ' | ||
> | r': 18, 's': 19, 't': 20, | > | r': 18, 's': 19, 't': 20, | ||
71 | 'u': 21, 'v': 22, 'w': 23, 'x': 24, 'y': 25, 'z': 26 } | 18 | 'u': 21, 'v': 22, 'w': 23, 'x': 24, 'y': 25, 'z': 26 } | ||
n | 72 | if lowerd[char] in lowerd.values(): | n | 19 | newval = alphabet[char] - shift |
73 | shifted = lowerd[char] - shift | 20 | if newval <= 0: | ||
74 | if shifted <= 0: | 21 | newval += 26 | ||
75 | shifted +=26 | 22 | for key, value in alphabet.items(): | ||
76 | lowerd.update({char: shifted}) | 23 | if newval == value: | ||
77 | if lowerd[char] == lowerd['a'] and char !='a': | ||||
78 | char = 'a' | ||||
79 | elif lowerd[char] == lowerd['b'] and char != 'b': | ||||
80 | char = 'b' | ||||
81 | elif lowerd[char] == lowerd['c'] and char != 'c': | ||||
82 | char = 'c' | ||||
83 | elif lowerd[char] == lowerd['d'] and char != 'd': | ||||
84 | char = 'd' | ||||
85 | elif lowerd[char] == lowerd['e'] and char != 'e': | ||||
86 | char = 'e' | 24 | newchar = key | ||
87 | elif lowerd[char] == lowerd['f'] and char != 'f': | 25 | newtext += newchar | ||
88 | char = 'f' | 26 | else: | ||
89 | elif lowerd[char] == lowerd['g'] and char != 'g': | 27 | newchar = char | ||
90 | char = 'g' | 28 | newtext += newchar | ||
91 | elif lowerd[char] == lowerd['h'] and char != 'h': | 29 | return newtext | ||
92 | char = 'h' | ||||
93 | elif lowerd[char] == lowerd['i'] and char != 'i': | ||||
94 | char = 'i' | ||||
95 | elif lowerd[char] == lowerd['j'] and char != 'j': | ||||
96 | char = 'j' | ||||
97 | elif lowerd[char] == lowerd['k'] and char != 'k': | ||||
98 | char = 'k' | ||||
99 | elif lowerd[char] == lowerd['l'] and char != 'l': | ||||
100 | char = 'l' | ||||
101 | elif lowerd[char] == lowerd['m'] and char != 'm': | ||||
102 | char = 'm' | ||||
103 | elif lowerd[char] == lowerd['n'] and char != 'n': | ||||
104 | char = 'n' | ||||
105 | elif lowerd[char] == lowerd['o'] and char != 'o': | ||||
106 | char = 'o' | ||||
107 | elif lowerd[char] == lowerd['p'] and char != 'p': | ||||
108 | char = 'p' | ||||
109 | elif lowerd[char] == lowerd['q'] and char != 'q': | ||||
110 | char = 'q' | ||||
111 | elif lowerd[char] == lowerd['r'] and char != 'r': | ||||
112 | char = 'r' | ||||
113 | elif lowerd[char] == lowerd['s'] and char != 's': | ||||
114 | char = 's' | ||||
115 | elif lowerd[char] == lowerd['t'] and char != '': | ||||
116 | char = 't' | ||||
117 | elif lowerd[char] == lowerd['u'] and char != 'u': | ||||
118 | char = 'u' | ||||
119 | elif lowerd[char] == lowerd['v'] and char != 'v': | ||||
120 | char = 'v' | ||||
121 | elif lowerd[char] == lowerd['w'] and char != 'w': | ||||
122 | char = 'w' | ||||
123 | elif lowerd[char] == lowerd['x'] and char != 'x': | ||||
124 | char = 'x' | ||||
125 | elif lowerd[char] == lowerd['y'] and char != 'y': | ||||
126 | char = 'y' | ||||
127 | elif lowerd[char] == lowerd['z'] and char != 'z': | ||||
128 | char = 'z' | ||||
129 | charlist.append(char) | ||||
130 | coded = ''.join(charlist) | ||||
131 | return coded | ||||
132 | if __name__ == '__main__': | 30 | if __name__ == '__main__': | ||
133 | plaintext = input() | 31 | plaintext = input() | ||
134 | shift = int(input()) | 32 | shift = int(input()) | ||
n | 135 | print(encrypt(plaintext,shift))input = input() | n | 33 | print(encrypt(plaintext,shift))nums = input() |
136 | nums = input.split() | 34 | newList = nums.split() | ||
137 | nl=[] | 35 | for i in range(0, len(newList)): | ||
138 | for number in nums: | 36 | newList[i] = int(newList[i]) | ||
139 | number = int(number) | 37 | listAvg = int(sum(newList) / len(newList)) | ||
140 | nl.append(number) | 38 | listMax = max(newList) | ||
141 | avg = sum(nl)/len(nums) | ||||
142 | avgfinal = int(avg) | ||||
143 | print(avgfinal, max(nl))tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1, 'F | 39 | print(listAvg,listMax)tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1, 'F': | ||
> | ': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | > | 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, | ||
144 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | 40 | 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, ' | ||
> | S': 1, 'T': 1, | > | S': 1, 'T': 1, | ||
145 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | 41 | 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 } | ||
t | 146 | input = input() | t | 42 | newVar = input() |
147 | letters = [] | ||||
148 | numbers = [] | ||||
149 | for i in range(len(input)): | 43 | for i in range(len(newVar)): | ||
150 | letters.append(input[i]) | 44 | if i == 0: | ||
151 | for letter in letters: | 45 | oldNum = 0 | ||
152 | numbers.append(tile_dict[letter]) | 46 | else: | ||
153 | print(sum(numbers)) | 47 | oldNum = newNum | ||
48 | x = newVar[i] | ||||
49 | number = tile_dict[x] | ||||
50 | newNum = number + oldNum | ||||
51 | print(newNum) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|