Все задачи на 5.10.17 13:00

This commit is contained in:
2017-10-05 13:08:02 +03:00
parent 93746b05d7
commit ca2ca71f63
120 changed files with 2343 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
# RZ2T(SAM)_7.py
import sys
sys.stdin = open('input.txt', 'r')
sys.stdout = open('output.txt', 'w')
s = input()
a = []
for i in range(len(s)):
try:
if 1 <= int(s[i] + s[i+1]) <= 26:
a.append(int(s[i] + s[i+1]))
s = s[:i] + 'aa' + s[i+2:]
else:
raise Exception('No number')
except Exception:
try:
if int(s[i]):
a.append(int(s[i]))
s = s[:i] + 'a' + s[i + 1:]
except Exception:
pass
s = ''
slov = {
1: 'z',
2: 'y',
3: 'x',
4: 'w',
5: 'v',
6: 'u',
7: 't',
8: 's',
9: 'r',
10: 'q',
11: 'p',
12: 'o',
13: 'n',
14: 'm',
15: 'l',
16: 'k',
17: 'j',
18: 'i',
19: 'h',
20: 'g',
21: 'f',
22: 'e',
23: 'd',
24: 'c',
25: 'b',
26: 'a',
}
for i in a:
s += slov[i]
print(s)
# ------------------------------------------ #

View File

@@ -0,0 +1,29 @@
# RZ2T(SAM)_8.py
import sys
sys.stdin = open('input.txt', 'r')
sys.stdout = open('output.txt', 'w')
n = int(input())
a = list(map(int, input().split()))
counter_ros = 0
counter_vio = 0
ros = []
vio = []
for i in range(1, n+1):
if a[i-1] == i % 2:
if i % 2 == 0:
ros.append(i-1)
counter_ros += 1
else:
vio.append(i-1)
counter_vio += 1
if counter_vio == counter_ros:
print(counter_ros)
for i in range(counter_ros):
print(ros[i]+1, ' ', vio[i]+1)
else:
print(-1)
# ------------------------------------------ #

View File

@@ -0,0 +1,14 @@
import sys
sys.stdin = open('input.txt', 'r')
#sys.stdout = open('output.txt', 'w')
a = []
try:
while True:
a.append(int(input()))
except Exception:
pass
a.sort()
print(a[0])
print(a[len(a)-1])

29
uts/uts_2017_sum_py/2/das Normal file
View File

@@ -0,0 +1,29 @@
begin
var n := ReadInteger();
var roses := new integer[n];
var count_roses := 0;
var violets := new integer[n];
var count_violets := 0;
for var i := 1 to n do
begin
if ReadInteger() = i mod 2 then
if i mod 2 = 0 then
begin
roses[count_roses] := i;
inc(count_roses);
end
else
begin
violets[count_violets] := i;
inc(count_violets);
end;
end;
if count_roses = count_violets then
begin
writeln(count_roses);
for var i := 0 to count_roses - 1 do
println(roses[i], violets[i]);
end
else
write(-1)
end.

View File

@@ -0,0 +1,16 @@
160
160
185
170
160
130
110
170
190
160
160
130
190
145
210
130